diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/gs_parameters_controller.rb | 66 | ||||
-rw-r--r-- | app/models/gs_parameter.rb | 2 | ||||
-rw-r--r-- | app/views/gs_parameters/_form.html.erb | 15 | ||||
-rw-r--r-- | app/views/gs_parameters/_form.html.haml | 7 | ||||
-rw-r--r-- | app/views/gs_parameters/_form_core.html.haml | 6 | ||||
-rw-r--r-- | app/views/gs_parameters/_index_core.html.haml | 17 | ||||
-rw-r--r-- | app/views/gs_parameters/edit.html.erb | 6 | ||||
-rw-r--r-- | app/views/gs_parameters/edit.html.haml | 3 | ||||
-rw-r--r-- | app/views/gs_parameters/index.html.erb | 29 | ||||
-rw-r--r-- | app/views/gs_parameters/index.html.haml | 6 | ||||
-rw-r--r-- | app/views/gs_parameters/new.html.erb | 5 | ||||
-rw-r--r-- | app/views/gs_parameters/new.html.haml | 3 | ||||
-rw-r--r-- | app/views/gs_parameters/show.html.erb | 25 | ||||
-rw-r--r-- | app/views/gs_parameters/show.html.haml | 19 |
14 files changed, 75 insertions, 134 deletions
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index d6a92c6..be3378e 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -1,83 +1,41 @@ class GsParametersController < ApplicationController - # GET /gs_parameters - # GET /gs_parameters.json def index @gs_parameters = GsParameter.all - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @gs_parameters } - end end - # GET /gs_parameters/1 - # GET /gs_parameters/1.json def show @gs_parameter = GsParameter.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render json: @gs_parameter } - end end - # GET /gs_parameters/new - # GET /gs_parameters/new.json def new @gs_parameter = GsParameter.new + end - respond_to do |format| - format.html # new.html.erb - format.json { render json: @gs_parameter } + def create + @gs_parameter = GsParameter.new(params[:gs_parameter]) + if @gs_parameter.save + redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_created') + else + render :new end end - # GET /gs_parameters/1/edit def edit @gs_parameter = GsParameter.find(params[:id]) end - # POST /gs_parameters - # POST /gs_parameters.json - def create - @gs_parameter = GsParameter.new(params[:gs_parameter]) - - respond_to do |format| - if @gs_parameter.save - format.html { redirect_to @gs_parameter, notice: 'Gs parameter was successfully created.' } - format.json { render json: @gs_parameter, status: :created, location: @gs_parameter } - else - format.html { render action: "new" } - format.json { render json: @gs_parameter.errors, status: :unprocessable_entity } - end - end - end - - # PUT /gs_parameters/1 - # PUT /gs_parameters/1.json def update @gs_parameter = GsParameter.find(params[:id]) - - respond_to do |format| - if @gs_parameter.update_attributes(params[:gs_parameter]) - format.html { redirect_to @gs_parameter, notice: 'Gs parameter was successfully updated.' } - format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @gs_parameter.errors, status: :unprocessable_entity } - end + if @gs_parameter.update_attributes(params[:gs_parameter]) + redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated') + else + render :edit end end - # DELETE /gs_parameters/1 - # DELETE /gs_parameters/1.json def destroy @gs_parameter = GsParameter.find(params[:id]) @gs_parameter.destroy - - respond_to do |format| - format.html { redirect_to gs_parameters_url } - format.json { head :no_content } - end + redirect_to gs_parameters_url, :notice => t('gs_parameters.controller.successfuly_destroyed') end end diff --git a/app/models/gs_parameter.rb b/app/models/gs_parameter.rb index aac10b0..8e30583 100644 --- a/app/models/gs_parameter.rb +++ b/app/models/gs_parameter.rb @@ -1,4 +1,6 @@ class GsParameter < ActiveRecord::Base + attr_accessible :name, :section, :value, :class_type, :description + validates :name, :presence => true, :uniqueness => true diff --git a/app/views/gs_parameters/_form.html.erb b/app/views/gs_parameters/_form.html.erb deleted file mode 100644 index e559bcc..0000000 --- a/app/views/gs_parameters/_form.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<%= simple_form_for(@gs_parameter) do |f| %> - <%= f.error_notification %> - - <div class="inputs"> - <%= f.input :name, :autofocus => true %> - <%= f.input :section %> - <%= f.input :value %> - <%= f.input :class_type %> - - </div> - - <div class="actions"> - <%= f.button :submit %> - </div> -<% end %> diff --git a/app/views/gs_parameters/_form.html.haml b/app/views/gs_parameters/_form.html.haml new file mode 100644 index 0000000..ea69e95 --- /dev/null +++ b/app/views/gs_parameters/_form.html.haml @@ -0,0 +1,7 @@ += simple_form_for(@gs_parameter) do |f| + = f.error_notification + + = render "form_core", :f => f + + .actions + = f.button :submit, conditional_t('gs_parameters.form.submit')
\ No newline at end of file diff --git a/app/views/gs_parameters/_form_core.html.haml b/app/views/gs_parameters/_form_core.html.haml new file mode 100644 index 0000000..ebb5f2d --- /dev/null +++ b/app/views/gs_parameters/_form_core.html.haml @@ -0,0 +1,6 @@ +.inputs + = f.input :name, :label => t('gs_parameters.form.name.label'), :hint => conditional_hint('gs_parameters.form.name.hint') + = f.input :section, :label => t('gs_parameters.form.section.label'), :hint => conditional_hint('gs_parameters.form.section.hint') + = f.input :value, :label => t('gs_parameters.form.value.label'), :hint => conditional_hint('gs_parameters.form.value.hint') + = f.input :class_type, :label => t('gs_parameters.form.class_type.label'), :hint => conditional_hint('gs_parameters.form.class_type.hint') + = f.input :description, :label => t('gs_parameters.form.description.label'), :hint => conditional_hint('gs_parameters.form.description.hint') diff --git a/app/views/gs_parameters/_index_core.html.haml b/app/views/gs_parameters/_index_core.html.haml new file mode 100644 index 0000000..cc6fdd9 --- /dev/null +++ b/app/views/gs_parameters/_index_core.html.haml @@ -0,0 +1,17 @@ +%table + %tr + %th= t('gs_parameters.index.name') + %th= t('gs_parameters.index.section') + %th= t('gs_parameters.index.value') + %th= t('gs_parameters.index.class_type') + %th= t('gs_parameters.index.description') + + - reset_cycle + - for gs_parameter in gs_parameters + %tr{:class => cycle('odd', 'even')} + %td= gs_parameter.name + %td= gs_parameter.section + %td= gs_parameter.value + %td= gs_parameter.class_type + %td= gs_parameter.description + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gs_parameter}
\ No newline at end of file diff --git a/app/views/gs_parameters/edit.html.erb b/app/views/gs_parameters/edit.html.erb deleted file mode 100644 index 6938a40..0000000 --- a/app/views/gs_parameters/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<h1>Editing gs_parameter</h1> - -<%= render 'form' %> - -<%= link_to 'Show', @gs_parameter %> | -<%= link_to 'Back', gs_parameters_path %> diff --git a/app/views/gs_parameters/edit.html.haml b/app/views/gs_parameters/edit.html.haml new file mode 100644 index 0000000..7c24234 --- /dev/null +++ b/app/views/gs_parameters/edit.html.haml @@ -0,0 +1,3 @@ +- title t("gs_parameters.edit.page_title") + += render "form"
\ No newline at end of file diff --git a/app/views/gs_parameters/index.html.erb b/app/views/gs_parameters/index.html.erb deleted file mode 100644 index dee6838..0000000 --- a/app/views/gs_parameters/index.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<h1>Listing gs_parameters</h1> - -<table> - <tr> - <th>Name</th> - <th>Section</th> - <th>Value</th> - <th>Class type</th> - <th></th> - <th></th> - <th></th> - </tr> - -<% @gs_parameters.each do |gs_parameter| %> - <tr> - <td><%= gs_parameter.name %></td> - <td><%= gs_parameter.section %></td> - <td><%= gs_parameter.value %></td> - <td><%= gs_parameter.class_type %></td> - <td><%= link_to 'Show', gs_parameter %></td> - <td><%= link_to 'Edit', edit_gs_parameter_path(gs_parameter) %></td> - <td><%= link_to 'Destroy', gs_parameter, confirm: 'Are you sure?', method: :delete %></td> - </tr> -<% end %> -</table> - -<br /> - -<%= link_to 'New Gs parameter', new_gs_parameter_path %> diff --git a/app/views/gs_parameters/index.html.haml b/app/views/gs_parameters/index.html.haml new file mode 100644 index 0000000..4c9ac84 --- /dev/null +++ b/app/views/gs_parameters/index.html.haml @@ -0,0 +1,6 @@ +- title t("gs_parameters.index.page_title") + +- if @gs_parameters && @gs_parameters.count > 0 + = render "index_core", :gs_parameters => @gs_parameters + += render :partial => 'shared/create_link', :locals => {:child_class => GsParameter}
\ No newline at end of file diff --git a/app/views/gs_parameters/new.html.erb b/app/views/gs_parameters/new.html.erb deleted file mode 100644 index a357e2e..0000000 --- a/app/views/gs_parameters/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<h1>New gs_parameter</h1> - -<%= render 'form' %> - -<%= link_to 'Back', gs_parameters_path %> diff --git a/app/views/gs_parameters/new.html.haml b/app/views/gs_parameters/new.html.haml new file mode 100644 index 0000000..845acc2 --- /dev/null +++ b/app/views/gs_parameters/new.html.haml @@ -0,0 +1,3 @@ +- title t("gs_parameters.new.page_title") + += render "form"
\ No newline at end of file diff --git a/app/views/gs_parameters/show.html.erb b/app/views/gs_parameters/show.html.erb deleted file mode 100644 index 1f03542..0000000 --- a/app/views/gs_parameters/show.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<p id="notice"><%= notice %></p> - -<p> - <b>Name:</b> - <%= @gs_parameter.name %> -</p> - -<p> - <b>Section:</b> - <%= @gs_parameter.section %> -</p> - -<p> - <b>Value:</b> - <%= @gs_parameter.value %> -</p> - -<p> - <b>Class type:</b> - <%= @gs_parameter.class_type %> -</p> - - -<%= link_to 'Edit', edit_gs_parameter_path(@gs_parameter) %> | -<%= link_to 'Back', gs_parameters_path %> diff --git a/app/views/gs_parameters/show.html.haml b/app/views/gs_parameters/show.html.haml new file mode 100644 index 0000000..185641d --- /dev/null +++ b/app/views/gs_parameters/show.html.haml @@ -0,0 +1,19 @@ +- title t("gs_parameters.show.page_title") + +%p + %strong= t('gs_parameters.show.name') + ":" + = @gs_parameter.name +%p + %strong= t('gs_parameters.show.section') + ":" + = @gs_parameter.section +%p + %strong= t('gs_parameters.show.value') + ":" + = @gs_parameter.value +%p + %strong= t('gs_parameters.show.class_type') + ":" + = @gs_parameter.class_type +%p + %strong= t('gs_parameters.show.description') + ":" + = @gs_parameter.description + += render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @gs_parameter }
\ No newline at end of file |