Class: Breeze::TranslationsController

Inherits:
BreezeController show all
Defined in:
app/controllers/breeze/translations_controller.rb

Instance Method Summary collapse

Methods inherited from BreezeController

#authenticate_if, #current_member_email

Instance Method Details

#createObject

POST /translations



20
21
22
23
24
25
26
27
28
# File 'app/controllers/breeze/translations_controller.rb', line 20

def create
  @translation = Translation.new(translation_params)

  if @translation.save
    redirect_to @translation, notice: "Translation was successfully created."
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject

DELETE /translations/1



43
44
45
46
# File 'app/controllers/breeze/translations_controller.rb', line 43

def destroy
  @translation.destroy
  redirect_to translations_url, notice: "Translation was successfully destroyed.", status: :see_other
end

#editObject

GET /translations/1/edit



16
17
# File 'app/controllers/breeze/translations_controller.rb', line 16

def edit
end

#newObject

GET /translations/new



11
12
13
# File 'app/controllers/breeze/translations_controller.rb', line 11

def new
  @translation = Translation.new
end

#showObject

show all translation for a page



6
7
8
# File 'app/controllers/breeze/translations_controller.rb', line 6

def show
  @page = Page.find(params[:id].to_i)
end

#updateObject

PATCH/PUT /translations/1



31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/breeze/translations_controller.rb', line 31

def update
  respond_to do |format|
     @translation.update(translation_params , current_member_email )
     format.html {
       redirect_to(translation_path(@translation.object.page.id),
                    :notice => 'Translation was successfully updated.')
     }
     format.json { render status: 200, json: {} }
   end
end