aureus 2.1.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +39 -40
  4. data/README.md +56 -64
  5. data/app/assets/javascripts/aureus/index.js +0 -41
  6. data/app/assets/javascripts/aureus/layout.js.erb +9 -0
  7. data/{spec/internal/app/assets/stylesheets/application.scss → app/assets/stylesheets/aureus/layout.scss.erb} +1 -1
  8. data/app/assets/stylesheets/aureus/skin/default.scss +0 -4
  9. data/app/assets/stylesheets/aureus/theme/content.scss +0 -4
  10. data/app/assets/stylesheets/aureus/theme/table.scss +1 -16
  11. data/app/assets/stylesheets/aureus/theme.scss +8 -0
  12. data/app/controllers/aureus/resources_controller.rb +52 -0
  13. data/app/controllers/aureus_controller.rb +2 -0
  14. data/app/views/aureus/resources/_form.html.haml +8 -0
  15. data/app/views/aureus/resources/_item.html.haml +7 -0
  16. data/app/views/aureus/resources/_navigation.html.haml +5 -0
  17. data/app/views/aureus/resources/_table.html.haml +11 -0
  18. data/app/views/aureus/resources/edit.html.haml +2 -0
  19. data/app/views/aureus/resources/index.html.haml +2 -0
  20. data/app/views/aureus/resources/new.html.haml +2 -0
  21. data/app/views/aureus/resources/show.html.haml +2 -0
  22. data/app/views/layouts/aureus.html.haml +14 -0
  23. data/aureus.gemspec +0 -1
  24. data/config.ru +1 -1
  25. data/lib/aureus/components/box.rb +8 -26
  26. data/lib/aureus/components/data_table.rb +15 -49
  27. data/lib/aureus/components/listing.rb +7 -14
  28. data/lib/aureus/components/messages.rb +2 -8
  29. data/lib/aureus/components/navigation.rb +5 -18
  30. data/lib/aureus/components/row.rb +4 -11
  31. data/lib/aureus/components/simple_map.rb +2 -8
  32. data/lib/aureus/components/toolbar.rb +14 -29
  33. data/lib/aureus/engine.rb +0 -3
  34. data/lib/aureus/helper.rb +18 -41
  35. data/lib/aureus/renderable.rb +6 -9
  36. data/lib/aureus/version.rb +1 -1
  37. data/lib/aureus.rb +10 -2
  38. data/lib/generators/aureus/copy/copy_generator.rb +13 -0
  39. data/lib/generators/aureus/setup/setup_generator.rb +12 -0
  40. data/spec/internal/app/controllers/all_controller.rb +0 -2
  41. data/spec/internal/app/controllers/application_controller.rb +2 -0
  42. data/spec/internal/app/controllers/resources_controller.rb +50 -1
  43. data/spec/internal/app/views/layouts/application.html.haml +6 -4
  44. data/spec/internal/app/views/layouts/naked.html.haml +4 -4
  45. data/spec/internal/config/initializers/aureus.rb +7 -0
  46. data/spec/internal/config/routes.rb +1 -1
  47. data/spec/lib/generators/copy_spec.rb +17 -0
  48. data/spec/lib/generators/setup_spec.rb +16 -0
  49. data/spec/requests/all_spec.rb +4 -3
  50. data/spec/requests/resources_spec.rb +23 -0
  51. metadata +27 -82
  52. data/app/assets/images/aureus/icon-sort-abc-asc.png +0 -0
  53. data/app/assets/images/aureus/icon-sort-abc-desc.png +0 -0
  54. data/app/assets/images/aureus/icon-sort.png +0 -0
  55. data/config/locales/aureus.de.yml +0 -9
  56. data/config/locales/aureus.en.yml +0 -9
  57. data/lib/aureus/components/content.rb +0 -19
  58. data/lib/generators/aureus/devise_i18n/devise_i18n_generator.rb +0 -25
  59. data/lib/generators/aureus/devise_i18n/locales/devise_base.de.yml +0 -55
  60. data/lib/generators/aureus/devise_i18n/locales/devise_base.en.yml +0 -55
  61. data/lib/generators/aureus/devise_i18n/locales/devise_mail.de.yml +0 -18
  62. data/lib/generators/aureus/devise_i18n/locales/devise_mail.en.yml +0 -18
  63. data/lib/generators/aureus/devise_i18n/locales/devise_ui.de.yml +0 -54
  64. data/lib/generators/aureus/devise_i18n/locales/devise_ui.en.yml +0 -54
  65. data/lib/generators/aureus/devise_invitable_i18n/devise_invitable_i18n_generator.rb +0 -25
  66. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.de.yml +0 -11
  67. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_base.en.yml +0 -11
  68. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.de.yml +0 -9
  69. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_mail.en.yml +0 -9
  70. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.de.yml +0 -12
  71. data/lib/generators/aureus/devise_invitable_i18n/locales/devise_invitable_ui.en.yml +0 -12
  72. data/lib/generators/aureus/devise_invitable_views/devise_invitable_views_generator.rb +0 -23
  73. data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/edit.html.haml +0 -9
  74. data/lib/generators/aureus/devise_invitable_views/templates/devise/invitations/new.html.haml +0 -8
  75. data/lib/generators/aureus/devise_invitable_views/templates/devise/mailer/invitation_instructions.html.haml +0 -5
  76. data/lib/generators/aureus/devise_views/devise_views_generator.rb +0 -25
  77. data/lib/generators/aureus/devise_views/templates/devise/confirmations/new.html.haml +0 -7
  78. data/lib/generators/aureus/devise_views/templates/devise/mailer/confirmation_instructions.html.haml +0 -3
  79. data/lib/generators/aureus/devise_views/templates/devise/mailer/reset_password_instructions.html.haml +0 -5
  80. data/lib/generators/aureus/devise_views/templates/devise/mailer/unlock_instructions.html.haml +0 -4
  81. data/lib/generators/aureus/devise_views/templates/devise/passwords/edit.html.haml +0 -9
  82. data/lib/generators/aureus/devise_views/templates/devise/passwords/new.html.haml +0 -7
  83. data/lib/generators/aureus/devise_views/templates/devise/registrations/edit.html.haml +0 -11
  84. data/lib/generators/aureus/devise_views/templates/devise/registrations/new.html.haml +0 -9
  85. data/lib/generators/aureus/devise_views/templates/devise/sessions/new.html.haml +0 -9
  86. data/lib/generators/aureus/devise_views/templates/devise/shared/_links.html.haml +0 -19
  87. data/lib/generators/aureus/devise_views/templates/devise/unlocks/new.html.haml +0 -7
  88. data/lib/generators/aureus/layout/layout_generator.rb +0 -19
  89. data/lib/generators/aureus/layout/templates/layout.html.haml +0 -17
  90. data/lib/generators/aureus/views/templates/views/_form.html.haml +0 -6
  91. data/lib/generators/aureus/views/templates/views/_item.html.haml +0 -6
  92. data/lib/generators/aureus/views/templates/views/_list.html.haml +0 -10
  93. data/lib/generators/aureus/views/templates/views/edit.html.haml +0 -7
  94. data/lib/generators/aureus/views/templates/views/index.html.haml +0 -6
  95. data/lib/generators/aureus/views/templates/views/new.html.haml +0 -7
  96. data/lib/generators/aureus/views/templates/views/show.html.haml +0 -7
  97. data/lib/generators/aureus/views/views_generator.rb +0 -81
  98. data/spec/controllers/all_spec.rb +0 -19
  99. data/spec/internal/app/assets/javascripts/application.js +0 -9
  100. data/spec/internal/public/favicon.ico +0 -0
  101. data/spec/lib/generators/devise_i18n_spec.rb +0 -19
  102. data/spec/lib/generators/devise_invitable_i18n_spec.rb +0 -19
  103. data/spec/lib/generators/devise_invitable_views_spec.rb +0 -19
  104. data/spec/lib/generators/devise_views_spec.rb +0 -25
  105. data/spec/lib/generators/layout_spec.rb +0 -17
  106. data/spec/lib/generators/views_spec.rb +0 -26
@@ -1,54 +0,0 @@
1
- en:
2
- devise:
3
- ui:
4
- confirmations:
5
- new:
6
- title: Resend confirmation instructions
7
- email: Your Email Address
8
- submit: Resend
9
- passwords:
10
- new:
11
- title: Lost you Password?
12
- email: Your Email Address
13
- submit: Send
14
- edit:
15
- title: Change Password
16
- password: Password
17
- password_confirmation: Password Confirmation
18
- submit: Change
19
- registrations:
20
- new:
21
- title: Sign Up
22
- email: Your Email
23
- password: Password
24
- password_confirmation: Password Confirmation
25
- submit: Sign Up
26
- edit:
27
- title: Edit %{name}
28
- email: Your Email
29
- password: Password
30
- password_confirmation: Password Confirmation
31
- current_password: Current Password
32
- submit: Update
33
- destroy: Delete Account
34
- destroy_confirm: Are you sure?
35
- back: Back
36
- sessions:
37
- new:
38
- title: Log In
39
- email: Email Address
40
- password: Password
41
- remember_me: Remember me?
42
- submit: Log In
43
- unlocks:
44
- new:
45
- title: Resend unlock instructions
46
- email: Email Address
47
- submit: Resend
48
- shared:
49
- links:
50
- login: Log In
51
- signup: Sign Up
52
- lost_password: Lost Password?
53
- no_confirmation: No Confirmation Mail Received?
54
- no_unlock: No Unlock Mail Received?
@@ -1,25 +0,0 @@
1
- module Aureus
2
-
3
- module Generators
4
-
5
- class DeviseInvitableI18nGenerator < Rails::Generators::Base
6
-
7
- desc 'generates base i18n files for the devise views'
8
- source_root File.expand_path('../locales', __FILE__)
9
- argument :language, type: :string, default: 'en'
10
-
11
- def generate
12
- file_list = Dir.glob("#{File.dirname(__FILE__)}/locales/*.#{language}.yml")
13
- puts "Generating invitable locale files for language: '#{language}'..."
14
- file_list.each do |locale_file|
15
- basename = File.basename(locale_file)
16
- destination = "config/locales/#{basename}"
17
- copy_file locale_file, destination
18
- end
19
- end
20
-
21
- end
22
-
23
- end
24
-
25
- end
@@ -1,11 +0,0 @@
1
- de:
2
- devise:
3
- invitations:
4
- send_instructions: 'An invitation email has been sent to %{email}.'
5
- invitation_token_invalid: 'The invitation token provided is not valid!'
6
- updated: 'Your password was set successfully. You are now signed in.'
7
- no_invitations_remaining: "No invitations remaining"
8
- invitation_removed: 'Your invitation was removed.'
9
- mailer:
10
- invitation_instructions:
11
- subject: Einladung
@@ -1,11 +0,0 @@
1
- en:
2
- devise:
3
- invitations:
4
- send_instructions: 'An invitation email has been sent to %{email}.'
5
- invitation_token_invalid: 'The invitation token provided is not valid!'
6
- updated: 'Your password was set successfully. You are now signed in.'
7
- no_invitations_remaining: "No invitations remaining"
8
- invitation_removed: 'Your invitation was removed.'
9
- mailer:
10
- invitation_instructions:
11
- subject: 'Invitation instructions'
@@ -1,9 +0,0 @@
1
- de:
2
- devise:
3
- mail:
4
- invitation_instructions:
5
- title: Hallo %{name}!
6
- info1: Jemand hat Ihnen zur %{website_url} eingeladet. Sie können das akzeptieren durch das Link unten.
7
- link: Einladung akzeptieren
8
- info2: Wenn Sie das nicht akzeptieren wollen, bitte dieses Email löschen.
9
- info3: Ihr Konto wird nicht aktiviert, wenn Sie das Link nicht clicken und ein Passwort nicht setzen.
@@ -1,9 +0,0 @@
1
- en:
2
- devise:
3
- mail:
4
- invitation_instructions:
5
- title: Hello %{name}!
6
- info1: Someone has invited you to %{website_url}, you can accept it through the link below.
7
- link: Accept invitation
8
- info2: If you don't want to accept the invitation, please ignore this email.
9
- info3: Your account won't be created until you access the link above and set your password.
@@ -1,12 +0,0 @@
1
- de:
2
- devise:
3
- ui:
4
- invitations:
5
- new:
6
- title: "Einladung"
7
- submit: "Einladung senden"
8
- edit:
9
- title: "Passwort setzen"
10
- password: "Passwort"
11
- password_confirmation: "Passwort Bestätigung"
12
- submit: "Bestätigen"
@@ -1,12 +0,0 @@
1
- en:
2
- devise:
3
- ui:
4
- invitations:
5
- new:
6
- title: "Send invitation"
7
- submit: "Send an invitation"
8
- edit:
9
- title: "Set your password"
10
- password: "Password"
11
- password_confirmation: "Password Confirmation"
12
- submit: "Confirm"
@@ -1,23 +0,0 @@
1
- module Aureus
2
-
3
- module Generators
4
-
5
- class DeviseInvitableViewsGenerator < Rails::Generators::Base
6
-
7
- desc 'generates aureus compliant devise invitable haml views with aureus helpers'
8
- source_root File.expand_path('../templates', __FILE__)
9
- argument :folder, type: :string, default: 'devise'
10
-
11
- def generate
12
- target = "app/views/#{folder}"
13
- directory 'devise', target
14
- Dir[target + '/**/*.haml'].each do |file|
15
- gsub_file file, '{{{folder}}}', folder, verbose: false
16
- end
17
- end
18
-
19
- end
20
-
21
- end
22
-
23
- end
@@ -1,9 +0,0 @@
1
- = aureus_box t('devise.ui.invitations.edit.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: invitation_path(resource_name), html: { method: :put } do |f|
4
- = f.hidden_field :invitation_token
5
- = f.password_field :password, label: t('devise.ui.invitations.edit.password')
6
- = f.password_field :password, label: t('devise.ui.invitations.edit.password_confirmation')
7
- = f.action :submit, label: t('devise.ui.invitations.new.submit')
8
- - b.foot do
9
- = render partial: '{{{folder}}}/shared/links'
@@ -1,8 +0,0 @@
1
- = aureus_box t('devise.ui.invitations.new.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: invitation_path(resource_name), html: { method: :post } do |f|
4
- - resource.class.invite_key_fields.each do |field|
5
- = f.input field.to_sym, label: t("devise.ui.invitations.new.#{field}")
6
- = f.action :submit, label: t('devise.ui.invitiations.new.submit')
7
- - b.foot do
8
- = render partial: '{{{folder}}}/shared/links'
@@ -1,5 +0,0 @@
1
- %p= t('devise.mail.invitation_instructions.title', name: @resource.email)
2
- %p= t('devise.mail.invitation_instructions.info1', website_url: root_url)
3
- %p= link_to t('devise.mail.invitation_instructions.link'), accept_invitation_url(@resource, invitation_token: @resource.invitation_token)
4
- %p= t('devise.mail.invitation_instructions.info2')
5
- %p= t('devise.mail.invitation_instructions.info3')
@@ -1,25 +0,0 @@
1
- module Aureus
2
-
3
- module Generators
4
-
5
- class DeviseViewsGenerator < Rails::Generators::Base
6
-
7
- desc 'generates aureus compliant devise haml views with aureus helpers and i18n files'
8
- source_root File.expand_path('../templates', __FILE__)
9
- argument :folder, type: :string, default: 'devise'
10
-
11
- def generate
12
- target = "app/views/#{folder}"
13
- directory 'devise', target do |content|
14
- content.gsub '{{{folder}}}', folder
15
- end
16
- #Dir[target + '/**/*.haml'].each do |file|
17
- #gsub_file file, '{{{folder}}}', folder, verbose: false
18
- #end
19
- end
20
-
21
- end
22
-
23
- end
24
-
25
- end
@@ -1,7 +0,0 @@
1
- = aureus_box t('devise.ui.confirmations.new.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post } do |f|
4
- = f.input :email, label: t('devise.ui.confirmations.new.email')
5
- = f.action :submit, label: t('devise.ui.confirmations.new.submit')
6
- - b.foot do
7
- = render partial: '{{{folder}}}/shared/links'
@@ -1,3 +0,0 @@
1
- %p= t('devise.mail.confirmation_instructions.title', name: @email)
2
- %p= t('devise.mail.confirmation_instructions.info')
3
- %p= link_to t('devise.mail.confirmation_instructions.link'), confirmation_url(@resource, confirmation_token: @token)
@@ -1,5 +0,0 @@
1
- %p= t('devise.mail.reset_password_instructions.title', name: @resource.email)
2
- %p= t('devise.mail.reset_password_instructions.info')
3
- %p= link_to t('devise.mail.reset_password_instructions.link'), edit_password_url(@resource, reset_password_token: @token)
4
- %p= t('devise.mail.reset_password_instructions.foot1')
5
- %p= t('devise.mail.reset_password_instructions.foot2')
@@ -1,4 +0,0 @@
1
- %p= t('devise.mail.unlock_instructions.title', name: @resource.email)
2
- %p= t('devise.mail.unlock_instructions.info1')
3
- %p= t('devise.mail.unlock_instructions.info2')
4
- %p= link_to t('devise.mail.unlock_instructions.link'), unlock_url(@resource, unlock_token: @token)
@@ -1,9 +0,0 @@
1
- = aureus_box t('devise.ui.passwords.edit.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: password_path(resource_name), html: { method: :put } do |form|
4
- = form.input :reset_password_token, as: :hidden
5
- = form.input :password, label: t('devise.ui.passwords.edit.password')
6
- = form.input :password_confirmation, label: t('devise.ui.passwords.edit.password_confirmation')
7
- = form.action :submit, label: t('devise.ui.passwords.edit.submit')
8
- - b.foot do
9
- = render partial: '{{{folder}}}/shared/links'
@@ -1,7 +0,0 @@
1
- = aureus_box t('devise.ui.passwords.new.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: password_path(resource_name), html: { method: :post } do |form|
4
- = form.input :email, label: t('devise.ui.passwords.new.email')
5
- = form.action :submit, label: t('devise.ui.passwords.new.submit')
6
- - b.foot do
7
- = render partial: '{{{folder}}}/shared/links'
@@ -1,11 +0,0 @@
1
- = aureus_box t('devise.ui.registrations.edit.title',name: resource_name.to_s.humanize), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: registration_path(resource_name), html: { method: :put } do |form|
4
- = form.input :email, label: t('devise.ui.registrations.edit.email')
5
- = form.input :password, label: t('devise.ui.registrations.edit.password')
6
- = form.input :password_confirmation, label: t('devise.ui.registrations.edit.password_confirmation')
7
- = form.input :current_password, label: t('devise.ui.registrations.edit.current_password')
8
- = form.action :submit, label: t('devise.ui.registrations.edit.submit')
9
- - b.foot do
10
- %p= link_to t('devise.ui.registrations.edit.destroy'), registration_path(resource_name), confirm: t('devise.ui.registrations.edit.destroy_confirm'), method: :delete
11
- %p= link_to t('devise.ui.registrations.edit.back'), :back
@@ -1,9 +0,0 @@
1
- = aureus_box t('devise.ui.registrations.new.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: registration_path(resource_name) do |form|
4
- = form.input :email, label: t('devise.ui.registrations.new.email')
5
- = form.input :password, label: t('devise.ui.registrations.new.password')
6
- = form.input :password_confirmation, label: t('devise.ui.registrations.new.password_confirmation')
7
- = form.action :submit, label: t('devise.ui.registrations.new.submit')
8
- - b.foot do
9
- = render partial: '{{{folder}}}/shared/links'
@@ -1,9 +0,0 @@
1
- = aureus_box t('devise.ui.sessions.new.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: session_path(resource_name) do |form|
4
- = form.input :email, label: t('devise.ui.sessions.new.email')
5
- = form.input :password, label: t('devise.ui.sessions.new.password')
6
- = form.input :remember_me, as: :boolean, label: t('devise.ui.sessions.new.remember_me') if devise_mapping.rememberable?
7
- = form.action :submit, label: t('devise.ui.sessions.new.submit')
8
- - b.foot do
9
- = render partial: '{{{folder}}}/shared/links'
@@ -1,19 +0,0 @@
1
- - if controller_name != 'sessions'
2
- = link_to t('devise.ui.shared.links.login'), new_session_path(resource_name)
3
- %br
4
-
5
- - if devise_mapping.registerable? && controller_name != 'registrations'
6
- = link_to t('devise.ui.shared.links.signup'), new_registration_path(resource_name)
7
- %br
8
-
9
- - if devise_mapping.recoverable? && controller_name != 'passwords'
10
- = link_to t('devise.ui.shared.links.lost_password'), new_password_path(resource_name)
11
- %br
12
-
13
- - if devise_mapping.confirmable? && controller_name != 'confirmations'
14
- = link_to t('devise.ui.shared.links.no_confirmation'), new_confirmation_path(resource_name)
15
- %br
16
-
17
- - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
18
- = link_to t('devise.ui.shared.links.no_unlock'), new_unlock_path(resource_name)
19
- %br
@@ -1,7 +0,0 @@
1
- = aureus_box t('devise.ui.unlocks.new.title'), centered: true, for: :form do |b|
2
- - b.content do
3
- = semantic_form_for resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post } do |form|
4
- = form.input :email, label: t('devise.ui.unlocks.new.email')
5
- = form.action :submit, label: t('devise.ui.unlocks.new.submit')
6
- - b.foot do
7
- = render partial: '{{{folder}}}/shared/links'
@@ -1,19 +0,0 @@
1
- module Aureus
2
-
3
- module Generators
4
-
5
- class LayoutGenerator < Rails::Generators::Base
6
-
7
- desc 'generate an aureus layout file'
8
- source_root File.expand_path('../templates', __FILE__)
9
- argument :name, required: true
10
-
11
- def generate
12
- copy_file 'layout.html.haml', "app/views/layouts/#{name}.html.haml"
13
- end
14
-
15
- end
16
-
17
- end
18
-
19
- end
@@ -1,17 +0,0 @@
1
- !!! 5
2
- %html
3
- %head
4
- %meta{ charset: 'utf-8' }/
5
- %title= t('.title')
6
- = stylesheet_link_tag 'application'
7
- = javascript_include_tag 'application'
8
- = csrf_meta_tag
9
- %body
10
- = aureus_toolbar t('.title') do |t|
11
- - t.left do |l|
12
- - l.link_to t('.root'), root_url
13
- - t.right do |r|
14
- - r.info 'info'
15
- = yield :navigation
16
- = aureus_messages flash
17
- = aureus_content yield
@@ -1,6 +0,0 @@
1
- = aureus_form [{{{form_path}}}] do |f|
2
- = aureus_row do |r|
3
- - r.column 25 do
4
- = aureus_box t('.box_title'), for: :form do
5
- {{{inputs}}}
6
- - r.space 75
@@ -1,6 +0,0 @@
1
- = aureus_row do |r|
2
- - r.column 25 do
3
- = aureus_box t('.box_title') do
4
- = aureus_listing do |l|
5
- {{{entries}}}
6
- - r.space 75
@@ -1,10 +0,0 @@
1
- = aureus_row do
2
- = aureus_box t('.box_title') do
3
- = aureus_datatable @{{{name_plural}}} do |t|
4
- - t.head do |h|
5
- {{{table_heads}}}
6
- - t.row do |r,{{{name_singular}}}|
7
- {{{table_cells}}}
8
- - r.button :show, {{{path_singular}}}_url({{{name_singular}}}) if can? :show, {{{name_singular}}}
9
- - r.button :edit, edit_{{{path_singular}}}_url({{{name_singular}}}) if can? :edit, {{{name_singular}}}
10
- - r.button :destroy, {{{path_singular}}}_url({{{name_singular}}}), confirm: t('.destroy_confirm') if can? :destroy, {{{name_singular}}}
@@ -1,7 +0,0 @@
1
- - content_for :navigation do
2
- = aureus_navigation do |n|
3
- - n.title t('.title')
4
- - n.button link_to t('.button_cancel'), {{{path_plural}}}_url if can? :show, @{{{name_singular}}}
5
- - n.submit_form_button @{{{name_singular}}}, t('.button_save') if can? :update, @{{{name_singular}}}
6
-
7
- = render 'form'
@@ -1,6 +0,0 @@
1
- - content_for :navigation do
2
- = aureus_navigation do |n|
3
- - n.title t('.title')
4
- - n.button link_to(t('.button_new'), new_{{{path_singular}}}_url) if can? :create, {{{model}}}
5
-
6
- = render 'list'
@@ -1,7 +0,0 @@
1
- - content_for :navigation do
2
- = aureus_navigation do |n|
3
- - n.title t('.title')
4
- - n.button link_to(t('.button_cancel'), {{{path_plural}}}_url) if can? :index, {{{model}}}
5
- - n.submit_form_button @{{{name_singular}}}, t('.button_save') if can? :create, {{{model}}}
6
-
7
- = render 'form'
@@ -1,7 +0,0 @@
1
- - content_for :navigation do
2
- = aureus_navigation do |n|
3
- - n.title t('.title')
4
- - n.button link_to(t('.button_edit'), edit_{{{path_singular}}}_url(@{{{name_singular}}})) if can? :update, @{{{name_singular}}}
5
- - n.button link_to(t('.button_back'),{{{path_plural}}}_url) if can? :index, {{{model}}}
6
-
7
- = render 'item'
@@ -1,81 +0,0 @@
1
- module Aureus
2
-
3
- module Generators
4
-
5
- class ViewsGenerator < Rails::Generators::Base
6
- include ActiveSupport::Inflector
7
-
8
- desc 'generates aures views for a existing model'
9
- source_root File.expand_path('../templates', __FILE__)
10
- class_option :yes, type: :boolean, default: false, description: 'do not ask'
11
- argument :resource, type: :string, required: true
12
- argument :controller, type: :string, required: true
13
- argument :columns, type: :array
14
-
15
- def generate
16
- model_name = resource.camelize
17
- folder = controller.gsub(/Controller$/,'').underscore
18
- target = ['app/views',folder].join '/'
19
- namespace = folder.split('/').slice(0...-1)
20
- model_name.constantize
21
- controller.constantize
22
- real_name = model_name.demodulize
23
- name_singular = real_name.underscore.downcase
24
- route = folder.gsub('/','_').singularize
25
-
26
- if options[:yes] or yes?("generate views for '#{model_name}' to: '#{target}'?")
27
- replacements = {
28
- model: model_name,
29
- name_singular: name_singular,
30
- name_plural: real_name.pluralize.underscore.downcase,
31
- path_singular: route,
32
- path_plural: route.pluralize,
33
- table_heads: columns.collect{ |c| "- h.text t('.column_#{c}')" }.join("\n").indent(8),
34
- table_cells: columns.collect{ |c| "- r.cell #{name_singular}.#{c}" }.join("\n").indent(8),
35
- entries: columns.collect{ |c| "- l.entry t('.entry_#{c}'), @#{name_singular}.#{c}" }.join("\n").indent(8),
36
- inputs: columns.collect{ |c| "= f.input :#{c}, label: t('.field_#{c}')" }.join("\n").indent(8),
37
- form_path: namespace.collect{ |n| "'#{n}'" }.push("@#{name_singular}").join(',')
38
- }
39
-
40
- directory 'views', target do |content|
41
- replacements.each do |key,value|
42
- content.gsub! "{{{#{key}}}}", value
43
- end
44
- content
45
- end
46
- end
47
-
48
- i18n_file = "config/locales/en/#{route.pluralize}.en.yml"
49
- if options[:yes] or yes?('generate i18n file to: '+i18n_file+'?')
50
- singular = real_name
51
- plural = real_name.pluralize
52
- base_i18n = {
53
- plural.downcase => {
54
- index: { title: plural, button_new: "Add #{singular}" },
55
- new: { title: 'New '+singular, button_cancel: 'Cancel', button_save: 'Save' },
56
- edit: { title: 'Edit '+singular, button_cancel: 'Cancel', button_save: 'Save' },
57
- form: { box_title: 'Details' },
58
- list: { box_title: plural+' Listing', destroy_confirm: "Really want to delete the #{singular}?" },
59
- show: { title: singular, button_edit: "Edit #{singular}", button_back: 'Back' },
60
- item: { box_title: 'Details' }
61
- }
62
- }
63
- columns.each do |c|
64
- base_i18n[plural.downcase][:item][("entry_#{c}")] = c.titleize
65
- base_i18n[plural.downcase][:list][("column_#{c}")] = c.titleize
66
- base_i18n[plural.downcase][:form][("field_#{c}")] = c.titleize
67
- end
68
- namespace.reverse.each do |n|
69
- base_i18n = { n => base_i18n }
70
- end
71
- base_i18n = { en: base_i18n }
72
- create_file i18n_file, base_i18n.deep_stringify_keys.to_yaml
73
- end
74
-
75
- end
76
-
77
- end
78
-
79
- end
80
-
81
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AllController do
4
- describe 'GET index' do
5
- it 'renders the index template' do
6
- get :index
7
- expect(response).to render_template('index')
8
- end
9
- end
10
- end
11
-
12
- describe AllController do
13
- describe 'GET centered' do
14
- it 'renders the centered template' do
15
- get :centered
16
- expect(response).to render_template('centered')
17
- end
18
- end
19
- end
@@ -1,9 +0,0 @@
1
- //= require aureus
2
- //= require_self
3
-
4
- $(function(){
5
- aureus({
6
- remove_messages_after: 3600,
7
- mapbox_id: 'examples.map-zr0njcqy'
8
- });
9
- });
File without changes
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require_relative '../../../lib/generators/aureus/devise_i18n/devise_i18n_generator'
4
-
5
- describe Aureus::Generators::DeviseI18nGenerator do
6
- destination File.expand_path('../../../../tmp/gen', __FILE__)
7
- arguments ['en']
8
-
9
- before do
10
- prepare_destination
11
- run_generator
12
- end
13
-
14
- it 'creates view files' do
15
- assert_file 'config/locales/devise_base.en.yml'
16
- assert_file 'config/locales/devise_mail.en.yml'
17
- assert_file 'config/locales/devise_ui.en.yml'
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require_relative '../../../lib/generators/aureus/devise_invitable_i18n/devise_invitable_i18n_generator'
4
-
5
- describe Aureus::Generators::DeviseInvitableI18nGenerator do
6
- destination File.expand_path('../../../../tmp/gen', __FILE__)
7
- arguments ['en']
8
-
9
- before do
10
- prepare_destination
11
- run_generator
12
- end
13
-
14
- it 'creates view files' do
15
- assert_file 'config/locales/devise_invitable_base.en.yml'
16
- assert_file 'config/locales/devise_invitable_mail.en.yml'
17
- assert_file 'config/locales/devise_invitable_ui.en.yml'
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require_relative '../../../lib/generators/aureus/devise_invitable_views/devise_invitable_views_generator'
4
-
5
- describe Aureus::Generators::DeviseInvitableViewsGenerator do
6
- destination File.expand_path('../../../../tmp/gen', __FILE__)
7
- arguments ['devise']
8
-
9
- before do
10
- prepare_destination
11
- run_generator
12
- end
13
-
14
- it 'creates view files' do
15
- assert_file 'app/views/devise/invitations/edit.html.haml'
16
- assert_file 'app/views/devise/invitations/new.html.haml'
17
- assert_file 'app/views/devise/mailer/invitation_instructions.html.haml'
18
- end
19
- end