phoenixbricks 3.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.txt +674 -0
  5. data/README.md +85 -0
  6. data/bin/rbricks +5 -0
  7. data/lib/railsbricks.rb +115 -0
  8. data/lib/railsbricks/app_generator.rb +352 -0
  9. data/lib/railsbricks/assets/config/admin_post_routes.rbr +3 -0
  10. data/lib/railsbricks/assets/config/application.yml +9 -0
  11. data/lib/railsbricks/assets/config/contact_routes.rbr +2 -0
  12. data/lib/railsbricks/assets/config/initializers/devise_email/devise.rb +267 -0
  13. data/lib/railsbricks/assets/config/initializers/devise_username/devise.rb +267 -0
  14. data/lib/railsbricks/assets/config/post_routes.rbr +2 -0
  15. data/lib/railsbricks/assets/config/routes.rb +15 -0
  16. data/lib/railsbricks/assets/config/unicorn.rb +22 -0
  17. data/lib/railsbricks/assets/controllers/admin/base_controller.rb +10 -0
  18. data/lib/railsbricks/assets/controllers/admin/devise_email/users_controller.rb +66 -0
  19. data/lib/railsbricks/assets/controllers/admin/devise_username/users_controller.rb +69 -0
  20. data/lib/railsbricks/assets/controllers/admin/posts_controller.rb +73 -0
  21. data/lib/railsbricks/assets/controllers/brick_contact.rbr +23 -0
  22. data/lib/railsbricks/assets/controllers/devise_email/application_controller.rb +54 -0
  23. data/lib/railsbricks/assets/controllers/devise_username/application_controller.rb +56 -0
  24. data/lib/railsbricks/assets/controllers/pages_controller.rb +13 -0
  25. data/lib/railsbricks/assets/controllers/posts_controller.rbr +10 -0
  26. data/lib/railsbricks/assets/database/postgresql.yml +12 -0
  27. data/lib/railsbricks/assets/database/sqlite3.yml +8 -0
  28. data/lib/railsbricks/assets/gemfile/Gemfile +44 -0
  29. data/lib/railsbricks/assets/git/gitignore +30 -0
  30. data/lib/railsbricks/assets/javascripts/analytics.js.coffee +5 -0
  31. data/lib/railsbricks/assets/lib/markdown_writer.rb +19 -0
  32. data/lib/railsbricks/assets/mailers/contact_mailer.rb +13 -0
  33. data/lib/railsbricks/assets/migrations/20141010133702_create_posts.rb +17 -0
  34. data/lib/railsbricks/assets/migrations/devise_email/20141010133701_devise_create_users.rb +48 -0
  35. data/lib/railsbricks/assets/migrations/devise_username/20141010133701_devise_create_users.rb +54 -0
  36. data/lib/railsbricks/assets/models/devise_email/user.rb +41 -0
  37. data/lib/railsbricks/assets/models/devise_username/user.rb +57 -0
  38. data/lib/railsbricks/assets/models/post.rb +30 -0
  39. data/lib/railsbricks/assets/procfile/Procfile +1 -0
  40. data/lib/railsbricks/assets/seeds/devise_email/seeds_no_test_users.rb +11 -0
  41. data/lib/railsbricks/assets/seeds/devise_email/seeds_test_users.rb +24 -0
  42. data/lib/railsbricks/assets/seeds/devise_username/seeds_no_test_users.rb +12 -0
  43. data/lib/railsbricks/assets/seeds/devise_username/seeds_test_users.rb +26 -0
  44. data/lib/railsbricks/assets/stylesheets/application.scss +6 -0
  45. data/lib/railsbricks/assets/stylesheets/railsbricks_custom.scss +562 -0
  46. data/lib/railsbricks/assets/views/admin/base/admin_posts_link.rbr +1 -0
  47. data/lib/railsbricks/assets/views/admin/base/devise_email/index.html.erb +41 -0
  48. data/lib/railsbricks/assets/views/admin/base/devise_username/index.html.erb +41 -0
  49. data/lib/railsbricks/assets/views/admin/posts/_form.html.erb +54 -0
  50. data/lib/railsbricks/assets/views/admin/posts/dashboard.html.erb +9 -0
  51. data/lib/railsbricks/assets/views/admin/posts/drafts.html.erb +23 -0
  52. data/lib/railsbricks/assets/views/admin/posts/edit.html.erb +10 -0
  53. data/lib/railsbricks/assets/views/admin/posts/index.html.erb +23 -0
  54. data/lib/railsbricks/assets/views/admin/posts/new.html.erb +6 -0
  55. data/lib/railsbricks/assets/views/admin/users/devise_email/edit.html.erb +65 -0
  56. data/lib/railsbricks/assets/views/admin/users/devise_email/index.html.erb +54 -0
  57. data/lib/railsbricks/assets/views/admin/users/devise_username/edit.html.erb +74 -0
  58. data/lib/railsbricks/assets/views/admin/users/devise_username/index.html.erb +56 -0
  59. data/lib/railsbricks/assets/views/contact_mailer/contact_message.html.erb +5 -0
  60. data/lib/railsbricks/assets/views/devise/allow_signup_links.rbr +11 -0
  61. data/lib/railsbricks/assets/views/devise/devise_email/confirmations/new.html.erb +31 -0
  62. data/lib/railsbricks/assets/views/devise/devise_email/mailer/confirmation_instructions.html.erb +12 -0
  63. data/lib/railsbricks/assets/views/devise/devise_email/mailer/reset_password_instructions.html.erb +15 -0
  64. data/lib/railsbricks/assets/views/devise/devise_email/passwords/edit.html.erb +43 -0
  65. data/lib/railsbricks/assets/views/devise/devise_email/passwords/new.html.erb +31 -0
  66. data/lib/railsbricks/assets/views/devise/devise_email/registrations/edit.html.erb +63 -0
  67. data/lib/railsbricks/assets/views/devise/devise_email/registrations/new.html.erb +49 -0
  68. data/lib/railsbricks/assets/views/devise/devise_email/sessions/new.html.erb +49 -0
  69. data/lib/railsbricks/assets/views/devise/devise_email/shared/_links.erb +19 -0
  70. data/lib/railsbricks/assets/views/devise/devise_username/confirmations/new.html.erb +31 -0
  71. data/lib/railsbricks/assets/views/devise/devise_username/mailer/confirmation_instructions.html.erb +12 -0
  72. data/lib/railsbricks/assets/views/devise/devise_username/mailer/reset_password_instructions.html.erb +15 -0
  73. data/lib/railsbricks/assets/views/devise/devise_username/passwords/edit.html.erb +43 -0
  74. data/lib/railsbricks/assets/views/devise/devise_username/passwords/new.html.erb +31 -0
  75. data/lib/railsbricks/assets/views/devise/devise_username/registrations/edit.html.erb +63 -0
  76. data/lib/railsbricks/assets/views/devise/devise_username/registrations/new.html.erb +58 -0
  77. data/lib/railsbricks/assets/views/devise/devise_username/sessions/new.html.erb +49 -0
  78. data/lib/railsbricks/assets/views/devise/devise_username/shared/_links.erb +19 -0
  79. data/lib/railsbricks/assets/views/layouts/_navigation_links.html.erb +15 -0
  80. data/lib/railsbricks/assets/views/layouts/brick_analytics.rbr +11 -0
  81. data/lib/railsbricks/assets/views/pages/contact.html.erb +46 -0
  82. data/lib/railsbricks/assets/views/pages/inside.html.erb +4 -0
  83. data/lib/railsbricks/assets/views/pages/posts.html.erb +18 -0
  84. data/lib/railsbricks/assets/views/pages/show_post.html.erb +6 -0
  85. data/lib/railsbricks/auth_builder.rb +147 -0
  86. data/lib/railsbricks/config_helpers.rb +27 -0
  87. data/lib/railsbricks/config_values.rb +14 -0
  88. data/lib/railsbricks/errors.rb +18 -0
  89. data/lib/railsbricks/file_helpers.rb +54 -0
  90. data/lib/railsbricks/foundation/README.md +24 -0
  91. data/lib/railsbricks/foundation/Rakefile +6 -0
  92. data/lib/railsbricks/foundation/app/assets/images/.keep +0 -0
  93. data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon-precomposed.png +0 -0
  94. data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon.png +0 -0
  95. data/lib/railsbricks/foundation/app/assets/images/favicon.ico +0 -0
  96. data/lib/railsbricks/foundation/app/assets/javascripts/application.js +17 -0
  97. data/lib/railsbricks/foundation/app/assets/javascripts/common.js +7 -0
  98. data/lib/railsbricks/foundation/app/controllers/application_controller.rb +5 -0
  99. data/lib/railsbricks/foundation/app/controllers/concerns/.keep +0 -0
  100. data/lib/railsbricks/foundation/app/controllers/pages_controller.rb +7 -0
  101. data/lib/railsbricks/foundation/app/helpers/application_helper.rb +7 -0
  102. data/lib/railsbricks/foundation/app/helpers/email_helper.rb +5 -0
  103. data/lib/railsbricks/foundation/app/mailers/.keep +0 -0
  104. data/lib/railsbricks/foundation/app/models/.keep +0 -0
  105. data/lib/railsbricks/foundation/app/models/concerns/.keep +0 -0
  106. data/lib/railsbricks/foundation/app/views/layouts/_footer.html.erb +18 -0
  107. data/lib/railsbricks/foundation/app/views/layouts/_messages.html.erb +9 -0
  108. data/lib/railsbricks/foundation/app/views/layouts/_navigation.html.erb +18 -0
  109. data/lib/railsbricks/foundation/app/views/layouts/_navigation_links.html.erb +3 -0
  110. data/lib/railsbricks/foundation/app/views/layouts/application.html.erb +38 -0
  111. data/lib/railsbricks/foundation/app/views/pages/home.html.erb +2 -0
  112. data/lib/railsbricks/foundation/bin/bundle +3 -0
  113. data/lib/railsbricks/foundation/bin/rails +4 -0
  114. data/lib/railsbricks/foundation/bin/rake +4 -0
  115. data/lib/railsbricks/foundation/config.ru +4 -0
  116. data/lib/railsbricks/foundation/config/application.rb +34 -0
  117. data/lib/railsbricks/foundation/config/boot.rb +4 -0
  118. data/lib/railsbricks/foundation/config/environment.rb +5 -0
  119. data/lib/railsbricks/foundation/config/environments/development.rb +41 -0
  120. data/lib/railsbricks/foundation/config/environments/production.rb +95 -0
  121. data/lib/railsbricks/foundation/config/environments/test.rb +51 -0
  122. data/lib/railsbricks/foundation/config/initializers/backtrace_silencers.rb +7 -0
  123. data/lib/railsbricks/foundation/config/initializers/date_format.rb +27 -0
  124. data/lib/railsbricks/foundation/config/initializers/filter_parameter_logging.rb +4 -0
  125. data/lib/railsbricks/foundation/config/initializers/friendly_id.rb +88 -0
  126. data/lib/railsbricks/foundation/config/initializers/inflections.rb +16 -0
  127. data/lib/railsbricks/foundation/config/initializers/kaminari_config.rb +10 -0
  128. data/lib/railsbricks/foundation/config/initializers/mime_types.rb +5 -0
  129. data/lib/railsbricks/foundation/config/initializers/secret_token.rb +25 -0
  130. data/lib/railsbricks/foundation/config/initializers/session_store.rb +3 -0
  131. data/lib/railsbricks/foundation/config/initializers/wrap_parameters.rb +14 -0
  132. data/lib/railsbricks/foundation/config/locales/en.yml +23 -0
  133. data/lib/railsbricks/foundation/config/routes.rb +7 -0
  134. data/lib/railsbricks/foundation/db/migrate/20131103142222_create_friendly_id_slugs.rb +15 -0
  135. data/lib/railsbricks/foundation/db/schema.rb +29 -0
  136. data/lib/railsbricks/foundation/db/seeds.rb +0 -0
  137. data/lib/railsbricks/foundation/lib/assets/.keep +0 -0
  138. data/lib/railsbricks/foundation/lib/tasks/.keep +0 -0
  139. data/lib/railsbricks/foundation/public/404.html +58 -0
  140. data/lib/railsbricks/foundation/public/422.html +58 -0
  141. data/lib/railsbricks/foundation/public/500.html +57 -0
  142. data/lib/railsbricks/foundation/public/favicon.ico +0 -0
  143. data/lib/railsbricks/foundation/public/robots.txt +5 -0
  144. data/lib/railsbricks/foundation/vendor/assets/javascripts/.keep +0 -0
  145. data/lib/railsbricks/foundation/vendor/assets/stylesheets/.keep +0 -0
  146. data/lib/railsbricks/gemfile_builder.rb +118 -0
  147. data/lib/railsbricks/menu.rb +533 -0
  148. data/lib/railsbricks/post_builder.rb +103 -0
  149. data/lib/railsbricks/string_helpers.rb +39 -0
  150. data/lib/railsbricks/style_builder.rb +97 -0
  151. data/lib/railsbricks/ui_helpers.rb +11 -0
  152. data/lib/railsbricks/validator.rb +68 -0
  153. data/lib/railsbricks/version.rb +34 -0
  154. data/railsbricks.gemspec +16 -0
  155. metadata +198 -0
@@ -0,0 +1 @@
1
+ <h4><%= link_to "Posts", admin_posts_dashboard_path %> <small>- <%= "#{pluralize(@post_count, 'post')}" %></small></h4>
@@ -0,0 +1,41 @@
1
+ <% title("Admin") %>
2
+ <h1>Admin <small>Home</small></h1>
3
+ <div class="row">
4
+ <div class="col-sm-4">
5
+ <h3>Menu</h3>
6
+ <h4><%= link_to "Users", admin_users_path %> <small>- <%= "#{pluralize(@count, 'user')}" %></small></h4>
7
+ BRICK_POSTS_LINK
8
+ <hr/>
9
+ </div>
10
+
11
+ <div class="col-sm-4">
12
+ <h3>Last Sign Ups</h3>
13
+ <ul class="list-unstyled">
14
+ <% @last_signups.each do |user| %>
15
+ <li class="list-padded-bottom">
16
+ <%= link_to user.email, edit_admin_user_path(user) %><br/>
17
+ <small><%= time_ago_in_words(user.created_at)%> ago</small>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+
23
+ <div class="col-sm-4">
24
+ <h3>Last Sign Ins</h3>
25
+ <ul class="list-unstyled">
26
+ <% @last_signins.each do |user| %>
27
+ <li class="list-padded-bottom">
28
+ <%= link_to user.email, edit_admin_user_path(user) %><br/>
29
+ <small>
30
+ <% unless user.last_sign_in_at.nil? %>
31
+ <%= time_ago_in_words(user.last_sign_in_at)%> ago
32
+ <% else %>
33
+ never
34
+ <% end %>
35
+ </small>
36
+ </li>
37
+ <% end %>
38
+ </ul>
39
+ </div>
40
+
41
+ </div>
@@ -0,0 +1,41 @@
1
+ <% title("Admin") %>
2
+ <h1>Admin <small>Home</small></h1>
3
+ <div class="row">
4
+ <div class="col-sm-4">
5
+ <h3>Menu</h3>
6
+ <h4><%= link_to "Users", admin_users_path %> <small>- <%= "#{pluralize(@count, 'user')}" %></small></h4>
7
+ BRICK_POSTS_LINK
8
+ <hr/>
9
+ </div>
10
+
11
+ <div class="col-sm-4">
12
+ <h3>Last Sign Ups</h3>
13
+ <ul class="list-unstyled">
14
+ <% @last_signups.each do |user| %>
15
+ <li class="list-padded-bottom">
16
+ <%= link_to user.username, edit_admin_user_path(user) %><br/>
17
+ <small><%= time_ago_in_words(user.created_at)%> ago</small>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+
23
+ <div class="col-sm-4">
24
+ <h3>Last Sign Ins</h3>
25
+ <ul class="list-unstyled">
26
+ <% @last_signins.each do |user| %>
27
+ <li class="list-padded-bottom">
28
+ <%= link_to user.username, edit_admin_user_path(user) %><br/>
29
+ <small>
30
+ <% unless user.last_sign_in_at.nil? %>
31
+ <%= time_ago_in_words(user.last_sign_in_at)%> ago
32
+ <% else %>
33
+ never
34
+ <% end %>
35
+ </small>
36
+ </li>
37
+ <% end %>
38
+ </ul>
39
+ </div>
40
+
41
+ </div>
@@ -0,0 +1,54 @@
1
+ <% if @post.errors.any? %>
2
+ <ul>
3
+ <% @post.errors.full_messages.each do |msg| %>
4
+ <li><%= msg %></li>
5
+ <% end %>
6
+ </ul>
7
+ <% end %>
8
+
9
+ <%= form_for [:admin, @post], role: "form" do |f| %>
10
+
11
+ <div class="form-group">
12
+ <%= f.label :title %>
13
+ <div class="row">
14
+ <div class="col-xs-12">
15
+ <%= f.text_field :title, :autofocus => true, class: "form-control monospaced-control", placeholder: "Title (also used for URL slug)..." %>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <%= f.label :content_md, "Content" %>
22
+ <div class="row">
23
+ <div class="col-xs-12">
24
+ <%= f.text_area :content_md, rows: 15, class: "form-control monospaced-control", placeholder: "Post content (Markdown format)..." %>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <div class="row">
31
+ <div class="col-xs-12">
32
+ <%= f.check_box :draft %> <%= f.label :draft, "draft" %>
33
+ </div>
34
+ </div>
35
+ </div>
36
+
37
+ <div class="form-group">
38
+ <%= f.label :updated_at, "Published date" %>
39
+ <div class="row">
40
+ <div class="col-xs-12">
41
+ <%= f.datetime_select :updated_at, class: "form-control" %>
42
+ </div>
43
+ </div>
44
+ </div>
45
+
46
+ <div class="row">
47
+ <div class="col-xs-12 padded">
48
+ <button class='btn btn-primary'>
49
+ <i class='fa fa-plus-square'></i> Publish
50
+ </button> - <%= link_to "Cancel", admin_posts_dashboard_path %>
51
+ </div>
52
+ </div>
53
+
54
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% title("Posts Dashboard") %>
2
+ <h3 class="page-title">Posts <small>Dashboard</small></h3>
3
+ <p><%= link_to "Back to Admin", admin_root_path %></p>
4
+ <hr/>
5
+ <div class="row">
6
+ <div class="col-sm-4">Published: <%= link_to "#{pluralize(@published_post_count, 'post')}", admin_posts_path %></div>
7
+ <div class="col-sm-4">Drafts: <%= link_to "#{pluralize(@draft_post_count, 'draft')}", admin_posts_drafts_path %></div>
8
+ <div class="col-sm-4"><%= link_to "New post", new_admin_post_path %></div>
9
+ </div>
@@ -0,0 +1,23 @@
1
+ <% title("Post Drafts") %>
2
+ <h3 class="page-title">Posts <small>Drafts</small></h3>
3
+ <p><%= link_to "Back to dashboard", admin_posts_dashboard_path %></p>
4
+ <hr/>
5
+
6
+ <p class="pagination-summary"><%= page_entries_info @posts %></p>
7
+ <%= paginate @posts %>
8
+
9
+ <hr/>
10
+
11
+ <ul class="fa-ul">
12
+ <% @posts.each do |post| %>
13
+ <li class="margin-md-down">
14
+ <i class="fa fa-arrow-circle-o-right small"></i>&nbsp;&nbsp;
15
+ <%= link_to post.title, edit_admin_post_path(post.slug) %> <br/>
16
+ <small class="x-small-text">about <%= time_ago_in_words(post.updated_at) %> ago</small>
17
+ </li>
18
+ <% end %>
19
+ </ul>
20
+
21
+ <hr/>
22
+
23
+ <%= paginate @posts %>
@@ -0,0 +1,10 @@
1
+ <% title("Edit #{@post.title}") %>
2
+ <h3 class="page-title">Edit post <small><%= @post.title %></small></h3>
3
+ <p>
4
+ <%= link_to "Back to dashboard", admin_posts_dashboard_path %>
5
+ </p>
6
+ <hr/>
7
+
8
+ <%= render 'form' %>
9
+ <hr/>
10
+ <%= link_to "<i class='fa fa-minus-square'></i> Delete post".html_safe, admin_post_path(@post), method: :delete, data:{confirm: "Are you sure?"}, class: "btn btn-small btn-danger" %>
@@ -0,0 +1,23 @@
1
+ <% title("Published posts") %>
2
+ <h3 class="page-title">Posts <small>Published</small></h3>
3
+ <p><%= link_to "Back to dashboard", admin_posts_dashboard_path %></p>
4
+ <hr/>
5
+
6
+ <p class="pagination-summary"><%= page_entries_info @posts %></p>
7
+ <%= paginate @posts %>
8
+
9
+ <hr/>
10
+
11
+ <ul class="fa-ul">
12
+ <% @posts.each do |post| %>
13
+ <li class="margin-md-down">
14
+ <i class="fa fa-arrow-circle-o-right small"></i>&nbsp;&nbsp;
15
+ <%= link_to post.title, edit_admin_post_path(post.slug) %> <br/>
16
+ <small class="x-small-text">about <%= time_ago_in_words(post.updated_at) %> ago</small>
17
+ </li>
18
+ <% end %>
19
+ </ul>
20
+
21
+ <hr/>
22
+
23
+ <%= paginate @posts %>
@@ -0,0 +1,6 @@
1
+ <% title("New post") %>
2
+ <h3 class="page-title">Add a new post</h3>
3
+ <p><%= link_to "Back to dashboard", admin_posts_dashboard_path %></p>
4
+ <hr/>
5
+
6
+ <%= render 'form' %>
@@ -0,0 +1,65 @@
1
+ <% title("Edit User Id: #{@user.id}") %>
2
+ <div class="row">
3
+ <div class="col-sm-6">
4
+ <h1>
5
+ Edit User <small><%= "#{@user.email} - id: #{@user.id}" %></small>
6
+ </h1>
7
+ <p><%= link_to "Back to Users", admin_users_path %></p>
8
+
9
+ <%= form_for [:admin, @user], :html => { :role => "form" } do |f| %>
10
+
11
+ <div class="form-group">
12
+ <%= f.label :email %>
13
+ <div class="row">
14
+ <div class="col-sm-6">
15
+ <%= f.email_field :email, class: "form-control" %>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <%= f.label :password %>
22
+ <div class="row">
23
+ <div class="col-sm-6">
24
+ <%= f.password_field :password, class: "form-control" %>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <%= f.label :password_confirmation %>
31
+ <div class="row">
32
+ <div class="col-sm-6">
33
+ <%= f.password_field :password_confirmation, class: "form-control" %>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ <% unless current_user.id == @user.id %>
39
+ <div class="form-group">
40
+ <div class="row">
41
+ <div class="col-sm-6">
42
+ <%= f.check_box :locked %> <%= f.label :locked, "Is Locked?" %>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <div class="form-group">
48
+ <div class="row">
49
+ <div class="col-sm-6">
50
+ <%= f.check_box :admin %> <%= f.label :admin, "Is Admin?" %>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <% end %>
55
+
56
+ <div class="row">
57
+ <div class="col-sm-6">
58
+ <%= f.submit "Update User", class: "btn btn-danger" %>
59
+ </div>
60
+ </div>
61
+
62
+ <% end %>
63
+
64
+ </div>
65
+ </div>
@@ -0,0 +1,54 @@
1
+ <% title("Users Admin") %>
2
+ <h1>Users <small>Admin</small></h1>
3
+ <p><%= link_to "Back to Admin", admin_root_path %></p>
4
+
5
+ <div class="text-center">
6
+ <p><%= page_entries_info @users %></p>
7
+ <%= paginate @users %>
8
+ </div>
9
+
10
+ <%= form_tag admin_users_path, method: 'get', html: {role: "form"} do %>
11
+ <p>
12
+ <%= text_field_tag :search, params[:search] %>
13
+ <%= submit_tag "Search", :name => nil, class: "btn btn-sm btn-primary" %>
14
+ <%= link_to "All", admin_users_path, {class: "btn btn-sm btn-link"} %>
15
+ </p>
16
+ <% end %>
17
+
18
+ <table class="table table-striped">
19
+ <tr>
20
+ <th>User ID</th>
21
+ <th>Admin</th>
22
+ <th>Locked</th>
23
+ <th>Email</th>
24
+ <th>Sign In Count</th>
25
+ <th>Created At</th>
26
+ <th>Last Sign In</th>
27
+ <th>Last Sign In IP</th>
28
+ </tr>
29
+
30
+ <% @users.each do |user| %>
31
+
32
+ <tr>
33
+ <td><%= user.id %></td>
34
+ <td><%= link_to user.email, admin_user_path(user) %></td>
35
+ <td><%= user.admin? ? "<b>yes</b>".html_safe : "no" %></td>
36
+ <td><%= user.locked? ? "<b>yes</b>".html_safe : "no" %></td>
37
+ <td><%= user.sign_in_count %></td>
38
+ <td><%= time_ago_in_words(user.created_at) %></td>
39
+ <% unless user.last_sign_in_at.nil? %>
40
+ <td><%= time_ago_in_words(user.last_sign_in_at)%> ago</td>
41
+ <% else %>
42
+ <td>never</td>
43
+ <% end %>
44
+ <td><%= user.last_sign_in_ip %></td>
45
+ </tr>
46
+
47
+ <% end %>
48
+
49
+ </table>
50
+
51
+ <div class="text-center">
52
+ <p><%= page_entries_info @users %></p>
53
+ <%= paginate @users %>
54
+ </div>
@@ -0,0 +1,74 @@
1
+ <% title("Edit User Id: #{@user.id}") %>
2
+ <div class="row">
3
+ <div class="col-sm-6">
4
+ <h1>
5
+ Edit User <small><%= "#{@user.username.capitalize} - id: #{@user.id}" %></small>
6
+ </h1>
7
+ <p><%= link_to "Back to Users", admin_users_path %></p>
8
+
9
+ <%= form_for [:admin, @user], :html => { :role => "form" } do |f| %>
10
+
11
+ <div class="form-group">
12
+ <%= f.label :username %>
13
+ <div class="row">
14
+ <div class="col-sm-6">
15
+ <%= f.text_field :username, :autofocus => true, class: "form-control" %>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <%= f.label :email %>
22
+ <div class="row">
23
+ <div class="col-sm-6">
24
+ <%= f.email_field :email, class: "form-control" %>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <%= f.label :password %>
31
+ <div class="row">
32
+ <div class="col-sm-6">
33
+ <%= f.password_field :password, class: "form-control" %>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="form-group">
39
+ <%= f.label :password_confirmation %>
40
+ <div class="row">
41
+ <div class="col-sm-6">
42
+ <%= f.password_field :password_confirmation, class: "form-control" %>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <% unless current_user.id == @user.id %>
48
+ <div class="form-group">
49
+ <div class="row">
50
+ <div class="col-sm-6">
51
+ <%= f.check_box :locked %> <%= f.label :locked, "Is Locked?" %>
52
+ </div>
53
+ </div>
54
+ </div>
55
+
56
+ <div class="form-group">
57
+ <div class="row">
58
+ <div class="col-sm-6">
59
+ <%= f.check_box :admin %> <%= f.label :admin, "Is Admin?" %>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <% end %>
64
+
65
+ <div class="row">
66
+ <div class="col-sm-6">
67
+ <%= f.submit "Update User", class: "btn btn-danger" %>
68
+ </div>
69
+ </div>
70
+
71
+ <% end %>
72
+
73
+ </div>
74
+ </div>
@@ -0,0 +1,56 @@
1
+ <% title("Users Admin") %>
2
+ <h1>Users <small>Admin</small></h1>
3
+ <p><%= link_to "Back to Admin", admin_root_path %></p>
4
+
5
+ <div class="text-center">
6
+ <p><%= page_entries_info @users %></p>
7
+ <%= paginate @users %>
8
+ </div>
9
+
10
+ <%= form_tag admin_users_path, method: 'get', html: {role: "form"} do %>
11
+ <p>
12
+ <%= text_field_tag :search, params[:search] %>
13
+ <%= submit_tag "Search", :name => nil, class: "btn btn-sm btn-primary" %>
14
+ <%= link_to "All", admin_users_path, {class: "btn btn-sm btn-link"} %>
15
+ </p>
16
+ <% end %>
17
+
18
+ <table class="table table-striped">
19
+ <tr>
20
+ <th>User ID</th>
21
+ <th>Username</th>
22
+ <th>Admin</th>
23
+ <th>Locked</th>
24
+ <th>Email</th>
25
+ <th>Sign In Count</th>
26
+ <th>Created At</th>
27
+ <th>Last Sign In</th>
28
+ <th>Last Sign In IP</th>
29
+ </tr>
30
+
31
+ <% @users.each do |user| %>
32
+
33
+ <tr>
34
+ <td><%= user.id %></td>
35
+ <td><%= link_to user.username.capitalize, admin_user_path(user) %></td>
36
+ <td><%= user.admin? ? "<b>yes</b>".html_safe : "no" %></td>
37
+ <td><%= user.locked? ? "<b>yes</b>".html_safe : "no" %></td>
38
+ <td><%= user.email %></td>
39
+ <td><%= user.sign_in_count %></td>
40
+ <td><%= time_ago_in_words(user.created_at) %></td>
41
+ <% unless user.last_sign_in_at.nil? %>
42
+ <td><%= time_ago_in_words(user.last_sign_in_at)%> ago</td>
43
+ <% else %>
44
+ <td>never</td>
45
+ <% end %>
46
+ <td><%= user.last_sign_in_ip %></td>
47
+ </tr>
48
+
49
+ <% end %>
50
+
51
+ </table>
52
+
53
+ <div class="text-center">
54
+ <p><%= page_entries_info @users %></p>
55
+ <%= paginate @users %>
56
+ </div>