From cff2a63ee65ea195704180aafda8bfd6181af26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20DI=CC=87LEK?= Date: Wed, 18 Sep 2013 10:19:44 +0300 Subject: [PATCH] #30 breadcrumb added to generator --- CHANGELOG.md | 63 ++++++++++--------- Gemfile | 1 + Gemfile.lock | 2 + app/controllers/application_controller.rb | 1 + app/views/layouts/partials/_breadcrumb.haml | 4 +- config/locales/en.yml | 6 ++ config/locales/models.en.yml | 4 ++ config/locales/models.tr.yml | 4 ++ config/locales/tr.yml | 7 +++ db/schema.rb | 16 ++++- .../rails/responders_controller/controller.rb | 6 +- 11 files changed, 78 insertions(+), 36 deletions(-) create mode 100644 config/locales/models.en.yml create mode 100644 config/locales/models.tr.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index c539819..fa60550 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,53 +2,54 @@ #### [Current] #### - * [beff870](../../commit/beff870) - __(Muhammet DİLEK)__ [#29](../../issues/29) theme presentation page updated - * [72c0859](../../commit/72c0859) - __(Muhammet DİLEK)__ [#29](../../issues/29) bootstrap3 class added to generator and theme - * [6a88594](../../commit/6a88594) - __(Muhammet DİLEK)__ scheme.rb fixed - * [361c26d](../../commit/361c26d) - __(Muhammet DİLEK)__ [#20](../../issues/20) blank list and filter partial added to scaffold generator - * [89d3fd5](../../commit/89d3fd5) - __(Onur Özgür ÖZKAN)__ Update README.md + * [cf2f874](../../commit/cf2f874) - __(Muhammet DILEK)__ [#29](../../issues/29) navbar fixed + * [beff870](../../commit/beff870) - __(Muhammet DILEK)__ [#29](../../issues/29) theme presentation page updated + * [72c0859](../../commit/72c0859) - __(Muhammet DILEK)__ [#29](../../issues/29) bootstrap3 class added to generator and theme + * [6a88594](../../commit/6a88594) - __(Muhammet DILEK)__ scheme.rb fixed + * [361c26d](../../commit/361c26d) - __(Muhammet DILEK)__ [#20](../../issues/20) blank list and filter partial added to scaffold generator + * [89d3fd5](../../commit/89d3fd5) - __(Onur zgr ZKAN)__ Update README.md * [6f57aa7](../../commit/6f57aa7) - __(Ahmet Sezgin Duran)__ Update README.md - * [7c1f307](../../commit/7c1f307) - __(Muhammet DİLEK)__ [#20](../../issues/20) show_for config added - * [ca81bb4](../../commit/ca81bb4) - __(Muhammet DİLEK)__ [#20](../../issues/20) detail page added + * [7c1f307](../../commit/7c1f307) - __(Muhammet DILEK)__ [#20](../../issues/20) show_for config added + * [ca81bb4](../../commit/ca81bb4) - __(Muhammet DILEK)__ [#20](../../issues/20) detail page added * [19c5718](../../commit/19c5718) - __(Ahmet Sezgin Duran)__ Update README.md * [560fd1b](../../commit/560fd1b) - __(Ahmet Sezgin Duran)__ [#24](../../issues/24) Clean up code and add login links to README.md * [c581aa2](../../commit/c581aa2) - __(Ahmet Sezgin Duran)__ [#24](../../issues/24) Create default users for development and update README.md - * [1943cab](../../commit/1943cab) - __(Muhammet DİLEK)__ [#20](../../issues/20) edit and new page added - * [6206a77](../../commit/6206a77) - __(Muhammet DİLEK)__ [#20](../../issues/20) pagination view added - * [3c7bf81](../../commit/3c7bf81) - __(Muhammet DİLEK)__ [#20](../../issues/20) ransack form added + * [1943cab](../../commit/1943cab) - __(Muhammet DILEK)__ [#20](../../issues/20) edit and new page added + * [6206a77](../../commit/6206a77) - __(Muhammet DILEK)__ [#20](../../issues/20) pagination view added + * [3c7bf81](../../commit/3c7bf81) - __(Muhammet DILEK)__ [#20](../../issues/20) ransack form added * [f2b7ce3](../../commit/f2b7ce3) - __(emineeliftoscali)__ [#23](../../issues/23) Gems Updated with latest versions - Devise secret key added * [a862452](../../commit/a862452) - __(emineeliftoscali)__ [#23](../../issues/23) Gems Updated with latest versions - * [8d31387](../../commit/8d31387) - __(Onur Özgür ÖZKAN)__ [#6](../../issues/6) Add header to README.md + * [8d31387](../../commit/8d31387) - __(Onur zgr ZKAN)__ [#6](../../issues/6) Add header to README.md * [ee34b62](../../commit/ee34b62) - __(kadriye)__ [#6](../../issues/6) mail fixed on README.md * [3622339](../../commit/3622339) - __(kadriye)__ [#6](../../issues/6) README.md updated * [c2cab5d](../../commit/c2cab5d) - __(Ahmet Sezgin Duran)__ [#19](../../issues/19) Add README.md markdown for Travis CI - * [13a97e6](../../commit/13a97e6) - __(Muhammet DİLEK)__ [#20](../../issues/20) ransack added - * [f1f8c33](../../commit/f1f8c33) - __(Muhammet DİLEK)__ merge - * [28ec222](../../commit/28ec222) - __(Muhammet DİLEK)__ [#20](../../issues/20) index improved - * [453767f](../../commit/453767f) - __(Muhammet DİLEK)__ merge - * [e471486](../../commit/e471486) - __(Muhammet DİLEK)__ [#16](../../issues/16) add csrf_meta_tags to layouts + * [13a97e6](../../commit/13a97e6) - __(Muhammet DILEK)__ [#20](../../issues/20) ransack added + * [f1f8c33](../../commit/f1f8c33) - __(Muhammet DILEK)__ merge + * [28ec222](../../commit/28ec222) - __(Muhammet DILEK)__ [#20](../../issues/20) index improved + * [453767f](../../commit/453767f) - __(Muhammet DILEK)__ merge + * [e471486](../../commit/e471486) - __(Muhammet DILEK)__ [#16](../../issues/16) add csrf_meta_tags to layouts * [c338d33](../../commit/c338d33) - __(Ahmet Sezgin Duran)__ [#18](../../issues/18) Change default database of development to Sqlite3 - * [9429352](../../commit/9429352) - __(Muhammet DİLEK)__ [#20](../../issues/20) form improved - * [f07214a](../../commit/f07214a) - __(Muhammet DİLEK)__ [#21](../../issues/21) error class changed + * [9429352](../../commit/9429352) - __(Muhammet DILEK)__ [#20](../../issues/20) form improved + * [f07214a](../../commit/f07214a) - __(Muhammet DILEK)__ [#21](../../issues/21) error class changed * [52318cd](../../commit/52318cd) - __(Ahmet Sezgin Duran)__ [#19](../../issues/19) Fix README.md markdown of Gemnasium * [664c51a](../../commit/664c51a) - __(Ahmet Sezgin Duran)__ [#19](../../issues/19) Add README.md markdowns for Code Climate and Gemnasium - * [d62da34](../../commit/d62da34) - __(Muhammet DİLEK)__ [#21](../../issues/21) file changed - * [fe16c6e](../../commit/fe16c6e) - __(Muhammet DİLEK)__ [#16](../../issues/16) application layout changed - * [e28bc55](../../commit/e28bc55) - __(Muhammet DİLEK)__ [#21](../../issues/21) Simple form improved for bootstrap 3 + * [d62da34](../../commit/d62da34) - __(Muhammet DILEK)__ [#21](../../issues/21) file changed + * [fe16c6e](../../commit/fe16c6e) - __(Muhammet DILEK)__ [#16](../../issues/16) application layout changed + * [e28bc55](../../commit/e28bc55) - __(Muhammet DILEK)__ [#21](../../issues/21) Simple form improved for bootstrap 3 * [eff7256](../../commit/eff7256) - __(Ahmet Sezgin Duran)__ [#19](../../issues/19) Add configuration file for Travis CI - * [7c7fa5b](../../commit/7c7fa5b) - __(Muhammet DİLEK)__ [#16](../../issues/16) form page added - * [aca6f8b](../../commit/aca6f8b) - __(Muhammet DİLEK)__ [#16](../../issues/16) tables page added - * [0008243](../../commit/0008243) - __(Muhammet DİLEK)__ [#16](../../issues/16) view helper moved to application helper - * [b39c20a](../../commit/b39c20a) - __(Muhammet DİLEK)__ [#16](../../issues/16) hq namespace base layout added - * [f954448](../../commit/f954448) - __(Muhammet DİLEK)__ [#16](../../issues/16) login layout added - * [51e9f1f](../../commit/51e9f1f) - __(Muhammet DİLEK)__ [#16](../../issues/16) partials added + * [7c7fa5b](../../commit/7c7fa5b) - __(Muhammet DILEK)__ [#16](../../issues/16) form page added + * [aca6f8b](../../commit/aca6f8b) - __(Muhammet DILEK)__ [#16](../../issues/16) tables page added + * [0008243](../../commit/0008243) - __(Muhammet DILEK)__ [#16](../../issues/16) view helper moved to application helper + * [b39c20a](../../commit/b39c20a) - __(Muhammet DILEK)__ [#16](../../issues/16) hq namespace base layout added + * [f954448](../../commit/f954448) - __(Muhammet DILEK)__ [#16](../../issues/16) login layout added + * [51e9f1f](../../commit/51e9f1f) - __(Muhammet DILEK)__ [#16](../../issues/16) partials added * [a9663dc](../../commit/a9663dc) - __(Onur Ozgur OZKAN)__ [#9](../../issues/9) Setup mailchimp settings - * [740c66a](../../commit/740c66a) - __(Muhammet DİLEK)__ [#16](../../issues/16) hierapolis assets added under the vendor + * [740c66a](../../commit/740c66a) - __(Muhammet DILEK)__ [#16](../../issues/16) hierapolis assets added under the vendor * [a7f31ef](../../commit/a7f31ef) - __(Onur Ozgur OZKAN)__ [#13](../../issues/13) Set staging env - * [d24d060](../../commit/d24d060) - __(Muhammet DİLEK)__ [#16](../../issues/16) bootstrap-sass gem updated for bootstrap 3 + * [d24d060](../../commit/d24d060) - __(Muhammet DILEK)__ [#16](../../issues/16) bootstrap-sass gem updated for bootstrap 3 * [8183086](../../commit/8183086) - __(Onur Ozgur OZKAN)__ [#15](../../issues/15) Set racktime out * [2cac814](../../commit/2cac814) - __(Onur Ozgur OZKAN)__ [#12](../../issues/12) Set default timezone and i18n * [6538045](../../commit/6538045) - __(Onur Ozgur OZKAN)__ [#14](../../issues/14) Vulnerability Note VU[#380039](../../issues/380039) @@ -56,5 +57,5 @@ * [071d9d8](../../commit/071d9d8) - __(Onur Ozgur OZKAN)__ [#10](../../issues/10) Add .editorconfig file * [1a7c073](../../commit/1a7c073) - __(Onur Ozgur OZKAN)__ [#8](../../issues/8) Add VERSION.txt * [f404cc1](../../commit/f404cc1) - __(Onur Ozgur OZKAN)__ [#7](../../issues/7) Add CHANGELOG.md - * [1a31842](../../commit/1a31842) - __(Muhammet DİLEK)__ [#5](../../issues/5) project created with cybele - * [20f347a](../../commit/20f347a) - __(Muhammet DİLEK)__ Initial commit + * [1a31842](../../commit/1a31842) - __(Muhammet DILEK)__ [#5](../../issues/5) project created with cybele + * [20f347a](../../commit/20f347a) - __(Muhammet DILEK)__ Initial commit diff --git a/Gemfile b/Gemfile index de592bb..25e9fbb 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ gem 'rack-timeout', '~> 0.0.4' gem 'recipient_interceptor', '~> 0.1.2' gem 'ransack' gem 'show_for', '~> 0.3.0.rc' +gem 'breadcrumbs_on_rails' group :doc do gem 'sdoc', require: false diff --git a/Gemfile.lock b/Gemfile.lock index b4f913d..6e618a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,6 +50,7 @@ GEM erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) + breadcrumbs_on_rails (2.3.0) builder (3.1.4) capybara (2.1.0) mime-types (>= 1.16) @@ -230,6 +231,7 @@ DEPENDENCIES better_errors binding_of_caller bootstrap-sass! + breadcrumbs_on_rails capybara (~> 2.1.0) coffee-rails (~> 4.0.0) compass-rails! diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7d1b7e6..c3acb57 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ require 'application_responder' class ApplicationController < ActionController::Base + add_breadcrumb I18n.t('navbar.root'), :root_path before_filter :set_user_time_zone diff --git a/app/views/layouts/partials/_breadcrumb.haml b/app/views/layouts/partials/_breadcrumb.haml index 770140f..6925489 100755 --- a/app/views/layouts/partials/_breadcrumb.haml +++ b/app/views/layouts/partials/_breadcrumb.haml @@ -1,4 +1,2 @@ %ul#breadcrumb.breadcrumb - %li.title= yield :title - %li= link_to 'Lorem', '#' - %li.active= link_to 'ipsum', '#' \ No newline at end of file + = render_breadcrumbs :separator => ' / ' \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 31465d6..ee1f6c8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -33,4 +33,10 @@ en: action_button: new: "New %{resource_name}" edit: "Edit" + tooltips: + edit: Edit + new: New + zoom: Detail + navbar: + root: Home diff --git a/config/locales/models.en.yml b/config/locales/models.en.yml new file mode 100644 index 0000000..85d8412 --- /dev/null +++ b/config/locales/models.en.yml @@ -0,0 +1,4 @@ +en: + activerecord: + models: + attributes: diff --git a/config/locales/models.tr.yml b/config/locales/models.tr.yml new file mode 100644 index 0000000..e7b1d3d --- /dev/null +++ b/config/locales/models.tr.yml @@ -0,0 +1,4 @@ +tr: + activerecord: + models: + attributes: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index fa77483..7489a3c 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -35,3 +35,10 @@ tr: action_button: new: "Yeni %{resource_name}" edit: "Düzenle" + + tooltips: + edit: Düzenle + new: Yeni + zoom: Detay + navbar: + root: Anasayfa diff --git a/db/schema.rb b/db/schema.rb index 1091583..cb9bb78 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20130905072700) do +ActiveRecord::Schema.define(version: 20130918071033) do create_table "admins", force: true do |t| t.string "email", default: "", null: false @@ -31,6 +31,20 @@ add_index "admins", ["email"], name: "index_admins_on_email", unique: true add_index "admins", ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true + create_table "companies", force: true do |t| + t.string "name" + t.integer "capacity" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "products", force: true do |t| + t.string "name" + t.integer "capacity" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "users", force: true do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false diff --git a/lib/templates/rails/responders_controller/controller.rb b/lib/templates/rails/responders_controller/controller.rb index 6b701ce..ed26100 100644 --- a/lib/templates/rails/responders_controller/controller.rb +++ b/lib/templates/rails/responders_controller/controller.rb @@ -2,7 +2,7 @@ <% module_namespacing do -%> class <%= controller_class_name %>Controller < ApplicationController before_action :<%= "set_#{singular_table_name}" %>, only: [:show, :edit, :update, :destroy] - + add_breadcrumb I18n.t('activerecord.models.<%= table_name %>'), :<%= table_name %>_path <% unless options[:singleton] -%> def index @search = <%= class_name %>.search(params[:q]) @@ -12,15 +12,19 @@ def index <% end -%> def show + add_breadcrumb @<%= file_name %>.<%= attributes.first.name %>, <%= singular_table_name %>_path(@<%= file_name %>) respond_with(@<%= file_name %>) end def new + add_breadcrumb t('tooltips.new'), new_<%= singular_table_name %>_path @<%= file_name %> = <%= orm_class.build(class_name) %> respond_with(@<%= file_name %>) end def edit + add_breadcrumb @<%= singular_table_name %>.id, <%= singular_table_name %>_path(@<%= singular_table_name %>) + add_breadcrumb t('tooltips.edit'), edit_<%= singular_table_name %>_path end def create