dq_admin 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +52 -0
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +173 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +28 -0
  7. data/Rakefile +36 -0
  8. data/app/assets/config/dq_admin_manifest.js +2 -0
  9. data/app/assets/images/dq_admin/.keep +0 -0
  10. data/app/assets/javascripts/dq_admin/application.js +14 -0
  11. data/app/assets/javascripts/dq_admin/dashboard.js +2 -0
  12. data/app/assets/javascripts/dq_admin/fields.js +2 -0
  13. data/app/assets/javascripts/dq_admin/products.js +2 -0
  14. data/app/assets/javascripts/dq_admin/users.js +2 -0
  15. data/app/assets/stylesheets/dq_admin/application.css +48 -0
  16. data/app/assets/stylesheets/dq_admin/dashboard.css +4 -0
  17. data/app/assets/stylesheets/dq_admin/fields.css +4 -0
  18. data/app/assets/stylesheets/dq_admin/products.css +4 -0
  19. data/app/assets/stylesheets/dq_admin/users.css +4 -0
  20. data/app/controllers/dq_admin/application_controller.rb +19 -0
  21. data/app/controllers/dq_admin/dashboard_controller.rb +6 -0
  22. data/app/controllers/dq_admin/fields_controller.rb +6 -0
  23. data/app/controllers/dq_admin/products_controller.rb +31 -0
  24. data/app/controllers/dq_admin/users_controller.rb +58 -0
  25. data/app/helpers/dq_admin/application_helper.rb +12 -0
  26. data/app/helpers/dq_admin/dashboard_helper.rb +4 -0
  27. data/app/helpers/dq_admin/fields_helper.rb +4 -0
  28. data/app/helpers/dq_admin/products_helper.rb +4 -0
  29. data/app/helpers/dq_admin/users_helper.rb +4 -0
  30. data/app/jobs/dq_admin/application_job.rb +4 -0
  31. data/app/mailers/dq_admin/application_mailer.rb +6 -0
  32. data/app/models/dq_admin/application_record.rb +5 -0
  33. data/app/models/dq_admin/article.rb +4 -0
  34. data/app/models/dq_admin/field.rb +13 -0
  35. data/app/models/dq_admin/product.rb +4 -0
  36. data/app/models/dq_admin/setting.rb +9 -0
  37. data/app/models/dq_admin/slide.rb +4 -0
  38. data/app/models/dq_admin/user.rb +30 -0
  39. data/app/services/dq_admin/field_service.rb +50 -0
  40. data/app/views/devise/confirmations/new.html.erb +16 -0
  41. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  42. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  43. data/app/views/devise/mailer/password_change.html.erb +3 -0
  44. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  45. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  46. data/app/views/devise/passwords/edit.html.erb +25 -0
  47. data/app/views/devise/passwords/new.html.erb +16 -0
  48. data/app/views/devise/registrations/edit.html.erb +43 -0
  49. data/app/views/devise/registrations/new.html.erb +29 -0
  50. data/app/views/devise/sessions/new.html.erb +35 -0
  51. data/app/views/devise/shared/_links.html.erb +25 -0
  52. data/app/views/devise/unlocks/new.html.erb +16 -0
  53. data/app/views/dq_admin/dashboard/index.html.erb +9 -0
  54. data/app/views/dq_admin/products/edit.html.erb +0 -0
  55. data/app/views/dq_admin/products/index.html.erb +54 -0
  56. data/app/views/dq_admin/products/new.html.erb +0 -0
  57. data/app/views/dq_admin/shared/_slidebar.html.erb +0 -0
  58. data/app/views/dq_admin/users/_form.html.erb +0 -0
  59. data/app/views/dq_admin/users/edit.html.erb +37 -0
  60. data/app/views/dq_admin/users/index.html.erb +53 -0
  61. data/app/views/dq_admin/users/new.html.erb +37 -0
  62. data/app/views/kaminari/_first_page.html.erb +3 -0
  63. data/app/views/kaminari/_gap.html.erb +3 -0
  64. data/app/views/kaminari/_last_page.html.erb +3 -0
  65. data/app/views/kaminari/_next_page.html.erb +3 -0
  66. data/app/views/kaminari/_page.html.erb +9 -0
  67. data/app/views/kaminari/_paginator.html.erb +15 -0
  68. data/app/views/kaminari/_prev_page.html.erb +3 -0
  69. data/app/views/layouts/dq_admin/application.html.erb +93 -0
  70. data/bin/rails +14 -0
  71. data/config/initializers/devise.rb +282 -0
  72. data/config/initializers/user.rb +1 -0
  73. data/config/locales/devise.en.yml +64 -0
  74. data/config/routes.rb +13 -0
  75. data/db/migrate/20180312020826_devise_create_dq_admin_users.rb +44 -0
  76. data/db/migrate/20180313060828_create_dq_admin_fields.rb +14 -0
  77. data/db/migrate/20180313125449_rename_config_to_option.rb +5 -0
  78. data/db/migrate/20180314235103_create_dq_admin_settings.rb +9 -0
  79. data/db/migrate/20180318070651_create_dq_admin_products.rb +13 -0
  80. data/db/migrate/20180318070806_create_dq_admin_slides.rb +11 -0
  81. data/db/migrate/20180318071018_create_dq_admin_articles.rb +12 -0
  82. data/db/migrate/20180318071514_add_username_to_users.rb +5 -0
  83. data/dq_admin.gemspec +33 -0
  84. data/lib/dq_admin/engine.rb +5 -0
  85. data/lib/dq_admin/version.rb +3 -0
  86. data/lib/dq_admin.rb +7 -0
  87. data/lib/tasks/dq_admin_tasks.rake +6 -0
  88. data/test/controllers/dq_admin/dashboard_controller_test.rb +11 -0
  89. data/test/controllers/dq_admin/fields_controller_test.rb +11 -0
  90. data/test/controllers/dq_admin/products_controller_test.rb +11 -0
  91. data/test/controllers/dq_admin/users_controller_test.rb +11 -0
  92. data/test/dq_admin_test.rb +7 -0
  93. data/test/dummy/Rakefile +6 -0
  94. data/test/dummy/app/assets/config/manifest.js +5 -0
  95. data/test/dummy/app/assets/images/.keep +0 -0
  96. data/test/dummy/app/assets/javascripts/application.js +15 -0
  97. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  98. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  99. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  100. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  101. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  102. data/test/dummy/app/controllers/application_controller.rb +3 -0
  103. data/test/dummy/app/controllers/concerns/.keep +0 -0
  104. data/test/dummy/app/helpers/application_helper.rb +2 -0
  105. data/test/dummy/app/jobs/application_job.rb +2 -0
  106. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  107. data/test/dummy/app/models/application_record.rb +3 -0
  108. data/test/dummy/app/models/concerns/.keep +0 -0
  109. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  110. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  111. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  112. data/test/dummy/bin/bundle +3 -0
  113. data/test/dummy/bin/rails +4 -0
  114. data/test/dummy/bin/rake +4 -0
  115. data/test/dummy/bin/setup +38 -0
  116. data/test/dummy/bin/update +29 -0
  117. data/test/dummy/bin/yarn +11 -0
  118. data/test/dummy/config/application.rb +18 -0
  119. data/test/dummy/config/boot.rb +5 -0
  120. data/test/dummy/config/cable.yml +10 -0
  121. data/test/dummy/config/database.yml +25 -0
  122. data/test/dummy/config/environment.rb +5 -0
  123. data/test/dummy/config/environments/development.rb +54 -0
  124. data/test/dummy/config/environments/production.rb +91 -0
  125. data/test/dummy/config/environments/test.rb +42 -0
  126. data/test/dummy/config/fields.json +20 -0
  127. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  128. data/test/dummy/config/initializers/assets.rb +14 -0
  129. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  130. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  131. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  132. data/test/dummy/config/initializers/inflections.rb +16 -0
  133. data/test/dummy/config/initializers/mime_types.rb +4 -0
  134. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  135. data/test/dummy/config/locales/en.yml +33 -0
  136. data/test/dummy/config/puma.rb +56 -0
  137. data/test/dummy/config/routes.rb +3 -0
  138. data/test/dummy/config/secrets.yml +32 -0
  139. data/test/dummy/config/spring.rb +6 -0
  140. data/test/dummy/config.ru +5 -0
  141. data/test/dummy/db/schema.rb +77 -0
  142. data/test/dummy/lib/assets/.keep +0 -0
  143. data/test/dummy/log/.keep +0 -0
  144. data/test/dummy/package.json +5 -0
  145. data/test/dummy/public/404.html +67 -0
  146. data/test/dummy/public/422.html +67 -0
  147. data/test/dummy/public/500.html +66 -0
  148. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  149. data/test/dummy/public/apple-touch-icon.png +0 -0
  150. data/test/dummy/public/favicon.ico +0 -0
  151. data/test/fixtures/dq_admin/articles.yml +13 -0
  152. data/test/fixtures/dq_admin/fields.yml +17 -0
  153. data/test/fixtures/dq_admin/products.yml +15 -0
  154. data/test/fixtures/dq_admin/settings.yml +7 -0
  155. data/test/fixtures/dq_admin/slides.yml +11 -0
  156. data/test/fixtures/dq_admin/users.yml +11 -0
  157. data/test/integration/navigation_test.rb +8 -0
  158. data/test/models/dq_admin/article_test.rb +9 -0
  159. data/test/models/dq_admin/field_test.rb +9 -0
  160. data/test/models/dq_admin/product_test.rb +9 -0
  161. data/test/models/dq_admin/setting_test.rb +9 -0
  162. data/test/models/dq_admin/slide_test.rb +9 -0
  163. data/test/models/dq_admin/user_test.rb +9 -0
  164. data/test/test_helper.rb +17 -0
  165. metadata +410 -0
@@ -0,0 +1,30 @@
1
+ module DqAdmin
2
+ class User < ApplicationRecord
3
+
4
+ DEFAULT_USER_EMAIL = 'admin@dq.com'
5
+
6
+ # Include default devise modules. Others available are:
7
+ # :confirmable, :lockable, :timeoutable and :omniauthable
8
+ devise :database_authenticatable,
9
+ :recoverable,
10
+ :rememberable,
11
+ :trackable,
12
+ :validatable
13
+
14
+
15
+ def self.populate
16
+ if User.count == 0
17
+ password = SecureRandom.hex
18
+ User.create(email: User::DEFAULT_USER_EMAIL, username: 'root', password: password, password_confirmation: password)
19
+ Rails.logger.info "[DQ] root user email: #{DEFAULT_USER_EMAIL} password: #{password}"
20
+ end
21
+ end
22
+
23
+ def self.generate_test_users
24
+ 100.times do |i|
25
+ name = rand(36**10).to_s(36)
26
+ User.create(email: "#{name}@sap.com", username: name, password: 'password', password_confirmation: 'password')
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,50 @@
1
+ module DqAdmin
2
+ class FieldService
3
+ def self.config
4
+ @@config ||= self.load
5
+ end
6
+
7
+ def self.load
8
+ File.open(Rails.root + "config/fields.json") do |file|
9
+ @@config = JSON.parse(file.read)
10
+ end
11
+ rescue => e
12
+ Rails.logger.info e.message
13
+ throw e if Rails.env.development?
14
+ []
15
+ end
16
+
17
+ def self.render(group, key, lang: I18n.locale.to_s)
18
+ raise "key is required for render field" if key.blank?
19
+ raise "group is required for render field" if group.blank?
20
+ raise "lang is required for render field" if lang.blank?
21
+
22
+ field_config = config.find {|item| item['key'] == key && item['group'] == group}
23
+ field = DynamicField.find_by(key: key, lang: lang, group: group)
24
+
25
+ if field.blank?
26
+ if block_given?
27
+ yield.html_safe
28
+ end
29
+ return nil
30
+ end
31
+
32
+ case field_config['type']
33
+ when Field::TEXTAREA
34
+ field.data.html_safe
35
+ when Field::INPUT
36
+ field.data
37
+ when Field::SLIDE
38
+ else
39
+ nil
40
+ end
41
+
42
+ rescue => e
43
+ Rails.logger.info e.message
44
+ if Rails.env.development?
45
+ raise e
46
+ end
47
+ nil
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,16 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend confirmation instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,5 @@
1
+ <p>Welcome <%= @email %>!</p>
2
+
3
+ <p>You can confirm your account email through the link below:</p>
4
+
5
+ <p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @email %>!</p>
2
+
3
+ <% if @resource.try(:unconfirmed_email?) %>
4
+ <p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
5
+ <% else %>
6
+ <p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
7
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>We're contacting you to notify you that your password has been changed.</p>
@@ -0,0 +1,8 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password. You can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4
+
5
+ <p>Click the link below to unlock your account:</p>
6
+
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
@@ -0,0 +1,25 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <div class="field">
8
+ <%= f.label :password, "New password" %><br />
9
+ <% if @minimum_password_length %>
10
+ <em>(<%= @minimum_password_length %> characters minimum)</em><br />
11
+ <% end %>
12
+ <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
13
+ </div>
14
+
15
+ <div class="field">
16
+ <%= f.label :password_confirmation, "Confirm new password" %><br />
17
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
18
+ </div>
19
+
20
+ <div class="actions">
21
+ <%= f.submit "Change my password" %>
22
+ </div>
23
+ <% end %>
24
+
25
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,16 @@
1
+ <h2>Forgot your password?</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Send me reset password instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,43 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
12
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
13
+ <% end %>
14
+
15
+ <div class="field">
16
+ <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
17
+ <%= f.password_field :password, autocomplete: "off" %>
18
+ <% if @minimum_password_length %>
19
+ <br />
20
+ <em><%= @minimum_password_length %> characters minimum</em>
21
+ <% end %>
22
+ </div>
23
+
24
+ <div class="field">
25
+ <%= f.label :password_confirmation %><br />
26
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
27
+ </div>
28
+
29
+ <div class="field">
30
+ <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
31
+ <%= f.password_field :current_password, autocomplete: "off" %>
32
+ </div>
33
+
34
+ <div class="actions">
35
+ <%= f.submit "Update" %>
36
+ </div>
37
+ <% end %>
38
+
39
+ <h3>Cancel my account</h3>
40
+
41
+ <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
42
+
43
+ <%= link_to "Back", :back %>
@@ -0,0 +1,29 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="field">
12
+ <%= f.label :password %>
13
+ <% if @minimum_password_length %>
14
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
15
+ <% end %><br />
16
+ <%= f.password_field :password, autocomplete: "off" %>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= f.label :password_confirmation %><br />
21
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
22
+ </div>
23
+
24
+ <div class="actions">
25
+ <%= f.submit "Sign up" %>
26
+ </div>
27
+ <% end %>
28
+
29
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,35 @@
1
+ <div class="login-box">
2
+ <div class="login-logo">
3
+ <a href="/">Admin</a>
4
+ </div>
5
+ <div class="login-box-body">
6
+ <p class="login-box-msg">Sign in to start your session</p>
7
+
8
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
9
+
10
+ <div class="form-group has-feedback">
11
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
12
+ <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
13
+ </div>
14
+
15
+ <div class="form-group has-feedback">
16
+ <%= f.password_field :password, autocomplete: "off", class: "form-control" %>
17
+ <span class="glyphicon glyphicon-lock form-control-feedback"></span>
18
+ </div>
19
+
20
+ <% if devise_mapping.rememberable? -%>
21
+ <div class="form-group has-feedback">
22
+ <%= f.check_box :remember_me %>
23
+ <%= f.label :remember_me, style: "font-weight: normal;" %>
24
+ </div>
25
+ <% end -%>
26
+
27
+ <div class="row">
28
+ <div class="col-xs-4">
29
+ <%= f.submit "Sign in", class: "btn btn-primary btn-block btn-flat" %>
30
+ </div>
31
+ </div>
32
+ <% end %>
33
+ </div>
34
+ </div>
35
+
@@ -0,0 +1,25 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Log in", new_session_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.omniauthable? %>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
24
+ <% end -%>
25
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend unlock instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,9 @@
1
+ <section class="content-header">
2
+ <h1>
3
+ Dashboard
4
+ </h1>
5
+ <ol class="breadcrumb">
6
+ <li><a href="/"><i class="fa fa-dashboard"></i> Home</a></li>
7
+ <li class="active">Dashboard</li>
8
+ </ol>
9
+ </section>
File without changes
@@ -0,0 +1,54 @@
1
+ <section class="content-header">
2
+ <h1>
3
+ Products
4
+ </h1>
5
+ <ol class="breadcrumb">
6
+ <li><a href="/"><i class="fa fa-dashboard"></i> Home</a></li>
7
+ <li class="active">Products</li>
8
+ </ol>
9
+ <div class="content-action">
10
+ <%= link_to "Create Product", new_product_path, class: "btn btn-primary" %>
11
+ </div>
12
+ </section>
13
+
14
+ <section class="body clearfix">
15
+ <div class="col-md-12">
16
+ <div class="box">
17
+ <div class="box-header">
18
+ <div class="box-tools">
19
+ </div>
20
+ </div>
21
+
22
+ <div class="box-body no-padding list-body">
23
+ <table class="table">
24
+ <tbody>
25
+ <tr>
26
+ <th style="width: 20px">ID</th>
27
+ <th>Name</th>
28
+ <th>Price</th>
29
+ <th>Buy</th>
30
+ <th style="width: 120px">Actions</th>
31
+ </tr>
32
+ <% @products.each do |p| %>
33
+ <tr>
34
+ <td><%= p.id %></td>
35
+ <td><%= p.name %></td>
36
+ <td><%= p.price %></td>
37
+ <td><%= p.buy_link %></td>
38
+ <td class="flex-center list-actions">
39
+ <%= link_to "detail", product_path(p) %>
40
+ <%= link_to "edit", edit_product_path(p) %>
41
+ <%= link_to "destroy", product_path(p), method: :delete %>
42
+ </td>
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+ </div>
48
+
49
+ <div class="list-nav">
50
+ <%= paginate @products %>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </section>
File without changes
File without changes
File without changes
@@ -0,0 +1,37 @@
1
+ <section class="content-header">
2
+ <h1>
3
+ Edit Admin User
4
+ </h1>
5
+ <ol class="breadcrumb">
6
+ <li><a href="/"><i class="fa fa-dashboard"></i> Home</a></li>
7
+ <li><a href="#">Tables</a></li>
8
+ <li class="active">Simple</li>
9
+ </ol>
10
+ </section>
11
+
12
+
13
+ <section class="content col-md-4">
14
+ <%= form_tag(user_path(@user), method: :put) do -%>
15
+ <div class="form-group">
16
+ <label for="title">Email</label>
17
+ <input type="text" class="form-control" id="title" name="users[email]" placeholder="Enter email" value=<%= @user.email %>>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <label for="title">Username</label>
22
+ <input type="text" class="form-control" id="title" name="users[username]" placeholder="Enter email" value=<%= @user.username %>>
23
+ </div>
24
+
25
+ <div class="form-group">
26
+ <label for="password">Password</label>
27
+ <input type="password" class="form-control" id="password" name="users[password]" placeholder="Enter password">
28
+ </div>
29
+
30
+ <div class="form-group">
31
+ <label for="password_confirmation">Password Confirmation</label>
32
+ <input type="password" class="form-control" id="password_confirmation" name="users[password_confirmation]" placeholder="Repeat password">
33
+ </div>
34
+
35
+ <input type="submit" class="btn btn-primary" id="article-save-btn" value="Save">
36
+ <% end %>
37
+ </section>
@@ -0,0 +1,53 @@
1
+ <section class="content-header">
2
+ <h1>
3
+ Admin Users
4
+ </h1>
5
+ <ol class="breadcrumb">
6
+ <li><a href="/"><i class="fa fa-dashboard"></i> Home</a></li>
7
+ <li class="active">Admins</li>
8
+ </ol>
9
+ <div class="content-action">
10
+ <%= link_to "Create Admin", new_user_path, class: "btn btn-primary" %>
11
+ </div>
12
+ </section>
13
+
14
+ <section class="body clearfix">
15
+ <div class="col-md-12">
16
+ <div class="box">
17
+ <div class="box-header">
18
+ <div class="box-tools">
19
+ </div>
20
+ </div>
21
+
22
+ <div class="box-body no-padding list-body">
23
+ <table class="table">
24
+ <tbody>
25
+ <tr>
26
+ <th style="width: 20px">ID</th>
27
+ <th>Email</th>
28
+ <th>Username</th>
29
+ <th>Last Login</th>
30
+ <th style="width: 120px">Actions</th>
31
+ </tr>
32
+ <% @users.each do |u| %>
33
+ <tr>
34
+ <td><%= u.id %></td>
35
+ <td><%= u.email%></td>
36
+ <td><%= u.username%></td>
37
+ <td><%= u.current_sign_in_at %></td>
38
+ <td class="flex-center list-actions">
39
+ <%= link_to "edit", edit_user_path(u) %>
40
+ <%= link_to "destroy", user_path(u), method: :delete %>
41
+ </td>
42
+ </tr>
43
+ <% end %>
44
+ </tbody>
45
+ </table>
46
+ </div>
47
+
48
+ <div class="list-nav">
49
+ <%= paginate @users %>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </section>
@@ -0,0 +1,37 @@
1
+ <section class="content-header">
2
+ <h1>
3
+ Create Admin Users
4
+ </h1>
5
+ <ol class="breadcrumb">
6
+ <li><a href="/"><i class="fa fa-dashboard"></i> Home</a></li>
7
+ <li><a href="#">Tables</a></li>
8
+ <li class="active">Simple</li>
9
+ </ol>
10
+ </section>
11
+
12
+
13
+ <section class="content col-md-4">
14
+ <%= form_tag(users_path(@user)) do -%>
15
+ <div class="form-group">
16
+ <label for="title">Email</label>
17
+ <input type="text" class="form-control" id="title" name="users[email]" placeholder="Enter email">
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <label for="title">Username</label>
22
+ <input type="text" class="form-control" id="title" name="users[username]" placeholder="Enter email">
23
+ </div>
24
+
25
+ <div class="form-group">
26
+ <label for="password">Password</label>
27
+ <input type="password" class="form-control" id="password" name="users[password]" placeholder="Enter password">
28
+ </div>
29
+
30
+ <div class="form-group">
31
+ <label for="password_confirmation">Password Confirmation</label>
32
+ <input type="password" class="form-control" id="password_confirmation" name="users[password_confirmation]" placeholder="Repeat password">
33
+ </div>
34
+
35
+ <input type="submit" class="btn btn-primary" id="article-save-btn" value="Save">
36
+ <% end %>
37
+ </section>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li class='disabled'>
2
+ <%= content_tag :a, raw(t 'views.pagination.truncate') %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
3
+ </li>
@@ -0,0 +1,9 @@
1
+ <% if page.current? %>
2
+ <li class='active'>
3
+ <%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
4
+ </li>
5
+ <% else %>
6
+ <li>
7
+ <%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
8
+ </li>
9
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <%= paginator.render do -%>
2
+ <ul class="pagination">
3
+ <%= first_page_tag unless current_page.first? %>
4
+ <%= prev_page_tag unless current_page.first? %>
5
+ <% each_page do |page| -%>
6
+ <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
7
+ <%= page_tag page %>
8
+ <% elsif !page.was_truncated? -%>
9
+ <%= gap_tag %>
10
+ <% end -%>
11
+ <% end -%>
12
+ <%= next_page_tag unless current_page.last? %>
13
+ <%= last_page_tag unless current_page.last? %>
14
+ </ul>
15
+ <% end -%>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
3
+ </li>