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

#autoObject



19
20
21
22
23
# File 'app/controllers/breeze/translations_controller.rb', line 19

def auto
  @translation.auto_translate(current_member_email)
  redirect_to(translation_path(@translation.object.page.id),
               :notice => 'Automatically translated.')
end

#createObject

POST /translations



26
27
28
29
30
31
32
33
34
# File 'app/controllers/breeze/translations_controller.rb', line 26

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



49
50
51
52
# File 'app/controllers/breeze/translations_controller.rb', line 49

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



37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/breeze/translations_controller.rb', line 37

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