From ca81bb4c417f992e349c001c7187887af9398b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20DI=CC=87LEK?= Date: Tue, 10 Sep 2013 14:04:45 +0300 Subject: [PATCH] #20 detail page added --- Gemfile | 1 + Gemfile.lock | 4 ++++ config/locales/en.yml | 5 +++++ config/locales/tr.yml | 7 ++++++- lib/templates/haml/scaffold/index.html.haml | 2 +- lib/templates/haml/scaffold/show.html.haml | 13 +++++++++++++ 6 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 lib/templates/haml/scaffold/show.html.haml diff --git a/Gemfile b/Gemfile index 34272b7..de592bb 100644 --- a/Gemfile +++ b/Gemfile @@ -25,6 +25,7 @@ gem 'kangal', '~> 1.0.0' gem 'rack-timeout', '~> 0.0.4' gem 'recipient_interceptor', '~> 0.1.2' gem 'ransack' +gem 'show_for', '~> 0.3.0.rc' group :doc do gem 'sdoc', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 08ad5c9..b4f913d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -185,6 +185,9 @@ GEM rdoc (~> 3.10) shoulda-matchers (2.3.0) activesupport (>= 3.0.0) + show_for (0.3.0.rc) + actionpack (>= 3.2, < 5) + activemodel (>= 3.2, < 5) simple_form (3.0.0.rc) actionpack (>= 4.0.0.rc1, < 4.1) activemodel (>= 4.0.0.rc1, < 4.1) @@ -252,6 +255,7 @@ DEPENDENCIES sass-rails (~> 4.0.0) sdoc shoulda-matchers (~> 2.3.0) + show_for (~> 0.3.0.rc) simple_form (~> 3.0.0.rc) sqlite3 (= 1.3.8) turbolinks (~> 1.3.0) diff --git a/config/locales/en.yml b/config/locales/en.yml index e3b8ae4..31465d6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -29,3 +29,8 @@ en: index: "%{resource_name} list" edit: "Editing %{resource_name}" new: "New %{resource_name}" + show: "%{resource_name} detail" + action_button: + new: "New %{resource_name}" + edit: "Edit" + diff --git a/config/locales/tr.yml b/config/locales/tr.yml index b31d247..fa77483 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -29,4 +29,9 @@ tr: tt: index: "%{resource_name} listesi" edit: "%{resource_name} düzenle" - new: "Yeni %{resource_name}" \ No newline at end of file + new: "Yeni %{resource_name}" + show: "%{resource_name} detay" + + action_button: + new: "Yeni %{resource_name}" + edit: "Düzenle" diff --git a/lib/templates/haml/scaffold/index.html.haml b/lib/templates/haml/scaffold/index.html.haml index 953c1c1..5cd4f0e 100644 --- a/lib/templates/haml/scaffold/index.html.haml +++ b/lib/templates/haml/scaffold/index.html.haml @@ -4,7 +4,7 @@ - content_for :toolbar do = link_to new_<%= singular_table_name %>_path, class: 'btn btn-default' do %i.icon-plus - = t('tt.new', resource_name: <%= singular_table_name.capitalize %>.model_name.human) + = t('action_button.new', resource_name: <%= singular_table_name.capitalize %>.model_name.human) .panel.tables .panel-heading diff --git a/lib/templates/haml/scaffold/show.html.haml b/lib/templates/haml/scaffold/show.html.haml new file mode 100644 index 0000000..2bb2710 --- /dev/null +++ b/lib/templates/haml/scaffold/show.html.haml @@ -0,0 +1,13 @@ +- content_for :toolbar do + = link_to edit_<%= singular_table_name %>_path(@<%= singular_name %> ), class: 'btn btn-default' do + %i.icon-pencil + = t('action_button.edit') +.panel + .panel-heading + %i.icon-edit.icon-large + = t('tt.show', resource_name: <%= singular_table_name.capitalize %>.model_name.human) + .panel-body + = show_for @<%= singular_name %> do |s| +<% attributes.each do |attribute| -%> + = s.<%= attribute.reference? ? :association : :attribute %> :<%= attribute.name %> +<% end -%> \ No newline at end of file