Sha256: f74550f9420d5b0bcb17dcaa33cd2cb0f31046b9c5eda0b36109f7012d38d2ab

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

class <%= @p_class_name %>Screen < ApplicationScreen
  title "<%= @p_title %>"

  # open_screen "<%= @p_name %>#index"
  def index
    set_title "<%= @p_title %>"
    set_navigation_right_button 'New' do
      open_screen "<%= @p_name %>#new"
    end
    set_section :<%= @p_name %>_table
  end

  # open_screen "<%= @p_name %>#show"
  def show
    @model = params[:model]
    set_title "Show <%= @s_title %>"
    set_navigation_back_button 'Back'
    set_navigation_right_button 'Edit' do
      open_screen "<%= @p_name %>#edit", params: { model: @model }
    end
    set_section :<%= @p_name %>_show, model: @model
  end

  # open_screen "<%= @p_name %>#edit"
  def edit
    @model = params[:model]
    set_title "Edit <%= @s_title %>"
    set_navigation_back_button 'Cancel'
    set_section :<%= @p_name %>_form, model: @model
  end

  # open_screen "<%= @p_name %>#new"
  def new
    @model = <%= @s_class_name %>.new
    set_title "New <%= @s_title %>"
    set_navigation_back_button 'Cancel'
    set_section :<%= @p_name %>_form, model: @model
  end

  def on_return
    if action?(:index)
      main_section.reload_data
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
motion-prime-0.9.1 generators/templates/scaffold/screen.rb
motion-prime-0.9.0 generators/templates/scaffold/screen.rb