phoenixbricks 3.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +674 -0
- data/README.md +85 -0
- data/bin/rbricks +5 -0
- data/lib/railsbricks.rb +115 -0
- data/lib/railsbricks/app_generator.rb +352 -0
- data/lib/railsbricks/assets/config/admin_post_routes.rbr +3 -0
- data/lib/railsbricks/assets/config/application.yml +9 -0
- data/lib/railsbricks/assets/config/contact_routes.rbr +2 -0
- data/lib/railsbricks/assets/config/initializers/devise_email/devise.rb +267 -0
- data/lib/railsbricks/assets/config/initializers/devise_username/devise.rb +267 -0
- data/lib/railsbricks/assets/config/post_routes.rbr +2 -0
- data/lib/railsbricks/assets/config/routes.rb +15 -0
- data/lib/railsbricks/assets/config/unicorn.rb +22 -0
- data/lib/railsbricks/assets/controllers/admin/base_controller.rb +10 -0
- data/lib/railsbricks/assets/controllers/admin/devise_email/users_controller.rb +66 -0
- data/lib/railsbricks/assets/controllers/admin/devise_username/users_controller.rb +69 -0
- data/lib/railsbricks/assets/controllers/admin/posts_controller.rb +73 -0
- data/lib/railsbricks/assets/controllers/brick_contact.rbr +23 -0
- data/lib/railsbricks/assets/controllers/devise_email/application_controller.rb +54 -0
- data/lib/railsbricks/assets/controllers/devise_username/application_controller.rb +56 -0
- data/lib/railsbricks/assets/controllers/pages_controller.rb +13 -0
- data/lib/railsbricks/assets/controllers/posts_controller.rbr +10 -0
- data/lib/railsbricks/assets/database/postgresql.yml +12 -0
- data/lib/railsbricks/assets/database/sqlite3.yml +8 -0
- data/lib/railsbricks/assets/gemfile/Gemfile +44 -0
- data/lib/railsbricks/assets/git/gitignore +30 -0
- data/lib/railsbricks/assets/javascripts/analytics.js.coffee +5 -0
- data/lib/railsbricks/assets/lib/markdown_writer.rb +19 -0
- data/lib/railsbricks/assets/mailers/contact_mailer.rb +13 -0
- data/lib/railsbricks/assets/migrations/20141010133702_create_posts.rb +17 -0
- data/lib/railsbricks/assets/migrations/devise_email/20141010133701_devise_create_users.rb +48 -0
- data/lib/railsbricks/assets/migrations/devise_username/20141010133701_devise_create_users.rb +54 -0
- data/lib/railsbricks/assets/models/devise_email/user.rb +41 -0
- data/lib/railsbricks/assets/models/devise_username/user.rb +57 -0
- data/lib/railsbricks/assets/models/post.rb +30 -0
- data/lib/railsbricks/assets/procfile/Procfile +1 -0
- data/lib/railsbricks/assets/seeds/devise_email/seeds_no_test_users.rb +11 -0
- data/lib/railsbricks/assets/seeds/devise_email/seeds_test_users.rb +24 -0
- data/lib/railsbricks/assets/seeds/devise_username/seeds_no_test_users.rb +12 -0
- data/lib/railsbricks/assets/seeds/devise_username/seeds_test_users.rb +26 -0
- data/lib/railsbricks/assets/stylesheets/application.scss +6 -0
- data/lib/railsbricks/assets/stylesheets/railsbricks_custom.scss +562 -0
- data/lib/railsbricks/assets/views/admin/base/admin_posts_link.rbr +1 -0
- data/lib/railsbricks/assets/views/admin/base/devise_email/index.html.erb +41 -0
- data/lib/railsbricks/assets/views/admin/base/devise_username/index.html.erb +41 -0
- data/lib/railsbricks/assets/views/admin/posts/_form.html.erb +54 -0
- data/lib/railsbricks/assets/views/admin/posts/dashboard.html.erb +9 -0
- data/lib/railsbricks/assets/views/admin/posts/drafts.html.erb +23 -0
- data/lib/railsbricks/assets/views/admin/posts/edit.html.erb +10 -0
- data/lib/railsbricks/assets/views/admin/posts/index.html.erb +23 -0
- data/lib/railsbricks/assets/views/admin/posts/new.html.erb +6 -0
- data/lib/railsbricks/assets/views/admin/users/devise_email/edit.html.erb +65 -0
- data/lib/railsbricks/assets/views/admin/users/devise_email/index.html.erb +54 -0
- data/lib/railsbricks/assets/views/admin/users/devise_username/edit.html.erb +74 -0
- data/lib/railsbricks/assets/views/admin/users/devise_username/index.html.erb +56 -0
- data/lib/railsbricks/assets/views/contact_mailer/contact_message.html.erb +5 -0
- data/lib/railsbricks/assets/views/devise/allow_signup_links.rbr +11 -0
- data/lib/railsbricks/assets/views/devise/devise_email/confirmations/new.html.erb +31 -0
- data/lib/railsbricks/assets/views/devise/devise_email/mailer/confirmation_instructions.html.erb +12 -0
- data/lib/railsbricks/assets/views/devise/devise_email/mailer/reset_password_instructions.html.erb +15 -0
- data/lib/railsbricks/assets/views/devise/devise_email/passwords/edit.html.erb +43 -0
- data/lib/railsbricks/assets/views/devise/devise_email/passwords/new.html.erb +31 -0
- data/lib/railsbricks/assets/views/devise/devise_email/registrations/edit.html.erb +63 -0
- data/lib/railsbricks/assets/views/devise/devise_email/registrations/new.html.erb +49 -0
- data/lib/railsbricks/assets/views/devise/devise_email/sessions/new.html.erb +49 -0
- data/lib/railsbricks/assets/views/devise/devise_email/shared/_links.erb +19 -0
- data/lib/railsbricks/assets/views/devise/devise_username/confirmations/new.html.erb +31 -0
- data/lib/railsbricks/assets/views/devise/devise_username/mailer/confirmation_instructions.html.erb +12 -0
- data/lib/railsbricks/assets/views/devise/devise_username/mailer/reset_password_instructions.html.erb +15 -0
- data/lib/railsbricks/assets/views/devise/devise_username/passwords/edit.html.erb +43 -0
- data/lib/railsbricks/assets/views/devise/devise_username/passwords/new.html.erb +31 -0
- data/lib/railsbricks/assets/views/devise/devise_username/registrations/edit.html.erb +63 -0
- data/lib/railsbricks/assets/views/devise/devise_username/registrations/new.html.erb +58 -0
- data/lib/railsbricks/assets/views/devise/devise_username/sessions/new.html.erb +49 -0
- data/lib/railsbricks/assets/views/devise/devise_username/shared/_links.erb +19 -0
- data/lib/railsbricks/assets/views/layouts/_navigation_links.html.erb +15 -0
- data/lib/railsbricks/assets/views/layouts/brick_analytics.rbr +11 -0
- data/lib/railsbricks/assets/views/pages/contact.html.erb +46 -0
- data/lib/railsbricks/assets/views/pages/inside.html.erb +4 -0
- data/lib/railsbricks/assets/views/pages/posts.html.erb +18 -0
- data/lib/railsbricks/assets/views/pages/show_post.html.erb +6 -0
- data/lib/railsbricks/auth_builder.rb +147 -0
- data/lib/railsbricks/config_helpers.rb +27 -0
- data/lib/railsbricks/config_values.rb +14 -0
- data/lib/railsbricks/errors.rb +18 -0
- data/lib/railsbricks/file_helpers.rb +54 -0
- data/lib/railsbricks/foundation/README.md +24 -0
- data/lib/railsbricks/foundation/Rakefile +6 -0
- data/lib/railsbricks/foundation/app/assets/images/.keep +0 -0
- data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon-precomposed.png +0 -0
- data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon.png +0 -0
- data/lib/railsbricks/foundation/app/assets/images/favicon.ico +0 -0
- data/lib/railsbricks/foundation/app/assets/javascripts/application.js +17 -0
- data/lib/railsbricks/foundation/app/assets/javascripts/common.js +7 -0
- data/lib/railsbricks/foundation/app/controllers/application_controller.rb +5 -0
- data/lib/railsbricks/foundation/app/controllers/concerns/.keep +0 -0
- data/lib/railsbricks/foundation/app/controllers/pages_controller.rb +7 -0
- data/lib/railsbricks/foundation/app/helpers/application_helper.rb +7 -0
- data/lib/railsbricks/foundation/app/helpers/email_helper.rb +5 -0
- data/lib/railsbricks/foundation/app/mailers/.keep +0 -0
- data/lib/railsbricks/foundation/app/models/.keep +0 -0
- data/lib/railsbricks/foundation/app/models/concerns/.keep +0 -0
- data/lib/railsbricks/foundation/app/views/layouts/_footer.html.erb +18 -0
- data/lib/railsbricks/foundation/app/views/layouts/_messages.html.erb +9 -0
- data/lib/railsbricks/foundation/app/views/layouts/_navigation.html.erb +18 -0
- data/lib/railsbricks/foundation/app/views/layouts/_navigation_links.html.erb +3 -0
- data/lib/railsbricks/foundation/app/views/layouts/application.html.erb +38 -0
- data/lib/railsbricks/foundation/app/views/pages/home.html.erb +2 -0
- data/lib/railsbricks/foundation/bin/bundle +3 -0
- data/lib/railsbricks/foundation/bin/rails +4 -0
- data/lib/railsbricks/foundation/bin/rake +4 -0
- data/lib/railsbricks/foundation/config.ru +4 -0
- data/lib/railsbricks/foundation/config/application.rb +34 -0
- data/lib/railsbricks/foundation/config/boot.rb +4 -0
- data/lib/railsbricks/foundation/config/environment.rb +5 -0
- data/lib/railsbricks/foundation/config/environments/development.rb +41 -0
- data/lib/railsbricks/foundation/config/environments/production.rb +95 -0
- data/lib/railsbricks/foundation/config/environments/test.rb +51 -0
- data/lib/railsbricks/foundation/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/railsbricks/foundation/config/initializers/date_format.rb +27 -0
- data/lib/railsbricks/foundation/config/initializers/filter_parameter_logging.rb +4 -0
- data/lib/railsbricks/foundation/config/initializers/friendly_id.rb +88 -0
- data/lib/railsbricks/foundation/config/initializers/inflections.rb +16 -0
- data/lib/railsbricks/foundation/config/initializers/kaminari_config.rb +10 -0
- data/lib/railsbricks/foundation/config/initializers/mime_types.rb +5 -0
- data/lib/railsbricks/foundation/config/initializers/secret_token.rb +25 -0
- data/lib/railsbricks/foundation/config/initializers/session_store.rb +3 -0
- data/lib/railsbricks/foundation/config/initializers/wrap_parameters.rb +14 -0
- data/lib/railsbricks/foundation/config/locales/en.yml +23 -0
- data/lib/railsbricks/foundation/config/routes.rb +7 -0
- data/lib/railsbricks/foundation/db/migrate/20131103142222_create_friendly_id_slugs.rb +15 -0
- data/lib/railsbricks/foundation/db/schema.rb +29 -0
- data/lib/railsbricks/foundation/db/seeds.rb +0 -0
- data/lib/railsbricks/foundation/lib/assets/.keep +0 -0
- data/lib/railsbricks/foundation/lib/tasks/.keep +0 -0
- data/lib/railsbricks/foundation/public/404.html +58 -0
- data/lib/railsbricks/foundation/public/422.html +58 -0
- data/lib/railsbricks/foundation/public/500.html +57 -0
- data/lib/railsbricks/foundation/public/favicon.ico +0 -0
- data/lib/railsbricks/foundation/public/robots.txt +5 -0
- data/lib/railsbricks/foundation/vendor/assets/javascripts/.keep +0 -0
- data/lib/railsbricks/foundation/vendor/assets/stylesheets/.keep +0 -0
- data/lib/railsbricks/gemfile_builder.rb +118 -0
- data/lib/railsbricks/menu.rb +533 -0
- data/lib/railsbricks/post_builder.rb +103 -0
- data/lib/railsbricks/string_helpers.rb +39 -0
- data/lib/railsbricks/style_builder.rb +97 -0
- data/lib/railsbricks/ui_helpers.rb +11 -0
- data/lib/railsbricks/validator.rb +68 -0
- data/lib/railsbricks/version.rb +34 -0
- data/railsbricks.gemspec +16 -0
- metadata +198 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-sm-6 ">
|
3
|
+
<h1>Forgot your password?</h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, :as => resource_name,
|
6
|
+
:url => password_path(resource_name),
|
7
|
+
:html => { :method => :post, :role => "form" }) do |f| %>
|
8
|
+
|
9
|
+
<%= devise_error_messages! %>
|
10
|
+
|
11
|
+
|
12
|
+
<div class="form-group">
|
13
|
+
<%= f.label :email %>
|
14
|
+
<div class="row">
|
15
|
+
<div class="col-sm-6">
|
16
|
+
<%= f.email_field :email, :autofocus => true, class: "form-control" %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
|
22
|
+
<div class="row">
|
23
|
+
<div class="col-sm-6">
|
24
|
+
<%= f.submit "Send me reset password instructions", class: "btn btn-primary" %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<%= render "devise/shared/links" %>
|
30
|
+
</div>
|
31
|
+
</div>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-sm-6 ">
|
3
|
+
<h1>Edit your profile</h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, :as => resource_name,
|
6
|
+
:url => registration_path(resource_name),
|
7
|
+
:html => { :method => :put, role: "form" }) do |f| %>
|
8
|
+
|
9
|
+
<%= devise_error_messages! %>
|
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, :autofocus => true, class: "form-control" %>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
21
|
+
<div class="row">
|
22
|
+
<div class="col-sm-6">
|
23
|
+
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<div class="form-group">
|
29
|
+
<%= f.label :password %> <i><small>(leave blank if you don't want to change it)</small></i>
|
30
|
+
<div class="row">
|
31
|
+
<div class="col-sm-6">
|
32
|
+
<%= f.password_field :password, :autocomplete => "off", class: "form-control" %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="form-group">
|
38
|
+
<%= f.label :password_confirmation %>
|
39
|
+
<div class="row">
|
40
|
+
<div class="col-sm-6">
|
41
|
+
<%= f.password_field :password_confirmation, class: "form-control" %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div class="form-group">
|
47
|
+
<%= f.label :current_password %> <i><small>(we need your current password to confirm your changes)</small></i>
|
48
|
+
<div class="row">
|
49
|
+
<div class="col-sm-6">
|
50
|
+
<%= f.password_field :current_password, class: "form-control" %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div class="row">
|
56
|
+
<div class="col-sm-6">
|
57
|
+
<%= f.submit "Update", class: "btn btn-primary" %> - <%= link_to "Cancel", inside_path %>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<% end %>
|
62
|
+
</div>
|
63
|
+
</div>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-sm-6">
|
3
|
+
<h1>Sign up</h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, :as => resource_name,
|
6
|
+
:url => registration_path(resource_name),
|
7
|
+
:html => { :role => "form" }) do |f| %>
|
8
|
+
|
9
|
+
<%= devise_error_messages! %>
|
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
|
+
<div class="row">
|
31
|
+
<div class="col-sm-6">
|
32
|
+
<%= f.label :password %>
|
33
|
+
<%= f.password_field :password, class: "form-control" %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="form-group">
|
39
|
+
<div class="row">
|
40
|
+
<div class="col-sm-6">
|
41
|
+
<%= f.label :password_confirmation %>
|
42
|
+
<%= f.password_field :password_confirmation, class: "form-control" %>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="row">
|
48
|
+
<div class="col-sm-6">
|
49
|
+
<%= f.submit "Sign up", class: "btn btn-primary" %>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
|
55
|
+
<%= render "devise/shared/links" %>
|
56
|
+
|
57
|
+
</div>
|
58
|
+
</div>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-sm-6 ">
|
3
|
+
<h1>Sign in</h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, :as => resource_name,
|
6
|
+
:url => session_path(resource_name),
|
7
|
+
role: "form") do |f| %>
|
8
|
+
|
9
|
+
<div class="form-group">
|
10
|
+
<%= f.label :username %>
|
11
|
+
<div class="row">
|
12
|
+
<div class="col-sm-6">
|
13
|
+
<%= f.text_field :username, :autofocus => true, class: "form-control" %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="form-group">
|
19
|
+
<%= f.label :password %>
|
20
|
+
<div class="row">
|
21
|
+
<div class="col-sm-6">
|
22
|
+
<%= f.password_field :password, class: "form-control" %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
<% if devise_mapping.rememberable? -%>
|
30
|
+
<div class="form-group">
|
31
|
+
<div class="row">
|
32
|
+
<div class="col-sm-6">
|
33
|
+
<%= f.check_box :remember_me %> <%= f.label :remember_me %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<% end -%>
|
38
|
+
|
39
|
+
<div class="row">
|
40
|
+
<div class="col-sm-6">
|
41
|
+
<%= f.submit "Sign in", class: "btn btn-primary" %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<%= render "devise/shared/links" %>
|
47
|
+
|
48
|
+
</div>
|
49
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="row shared-links">
|
2
|
+
<div class="col-sm-8">
|
3
|
+
<%- if controller_name != 'sessions' %>
|
4
|
+
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
5
|
+
<% end -%>
|
6
|
+
|
7
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
8
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
9
|
+
<% end -%>
|
10
|
+
|
11
|
+
BRICK_ALLOW_SIGNUP_LINKS
|
12
|
+
|
13
|
+
<%- if devise_mapping.omniauthable? %>
|
14
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
15
|
+
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
16
|
+
<% end -%>
|
17
|
+
<% end -%>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
BRICK_POSTS
|
2
|
+
BRICK_CONTACT
|
3
|
+
<% if !user_signed_in? %>
|
4
|
+
<li><%= link_to "Sign in", new_user_session_path %></li>
|
5
|
+
BRICK_ALLOW_SIGNUP_LINK
|
6
|
+
<% else %>
|
7
|
+
<li><%= link_to "Protected Page", inside_path %></li>
|
8
|
+
BRICK_ALLOW_EDIT_LINK
|
9
|
+
|
10
|
+
<% if current_user.admin? %>
|
11
|
+
<li><%= link_to "Admin", admin_root_path %></li>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<li><%= link_to "Sign out", destroy_user_session_path, data:{method: :delete} %></li>
|
15
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% if Rails.env == "production" %>
|
2
|
+
<script>
|
3
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
4
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
5
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
6
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
7
|
+
|
8
|
+
ga('create', 'BRICK_ANALYTICS_ID', 'auto');
|
9
|
+
ga('send', 'pageview');
|
10
|
+
</script>
|
11
|
+
<% end %>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<% title("Contact") %>
|
2
|
+
<h1 class="page-title">Contact</h1>
|
3
|
+
|
4
|
+
<div class="row">
|
5
|
+
<div class="col-sm-6">
|
6
|
+
|
7
|
+
<%= form_tag email_confirmation_path, method: 'post', html: {role: "form"} do %>
|
8
|
+
|
9
|
+
<div class="form-group">
|
10
|
+
<%= label_tag :name, "Your name" %>
|
11
|
+
<div class="row">
|
12
|
+
<div class="col-xs-12">
|
13
|
+
<%= text_field_tag :name, @name, placeholder: "Enter your name...", :autofocus => true, class: "form-control" %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="form-group">
|
19
|
+
<%= label_tag :email, "Your email" %>
|
20
|
+
<div class="row">
|
21
|
+
<div class="col-xs-12">
|
22
|
+
<%= text_field_tag :email, @email, placeholder: "Enter your email...", class: "form-control" %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="form-group">
|
28
|
+
<%= label_tag :message, "Your message" %>
|
29
|
+
<div class="row">
|
30
|
+
<div class="col-xs-12">
|
31
|
+
<%= text_area_tag :message, @message, placeholder: "Enter your message...", rows: 10, class: "form-control" %>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="row">
|
37
|
+
<div class="col-xs-12 padded">
|
38
|
+
<button class='btn btn-primary'>
|
39
|
+
<i class='fa fa-envelope'></i> Send
|
40
|
+
</button>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
<% end %>
|
44
|
+
|
45
|
+
</div>
|
46
|
+
</div>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<% title("Protected page") %>
|
2
|
+
<h1>Protected Page</h1>
|
3
|
+
<p>This page is only visible to signed in users. Edit it at: <em>views/pages/inside.html.erb</em></p>
|
4
|
+
<p>You can change the page users see after successfully signing in within the method <em>after_sign_in_path_for</em> inside <strong>application_controller.rb</strong></p>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% title("Posts") %>
|
2
|
+
<h1>Posts</h1>
|
3
|
+
|
4
|
+
<% @posts.each do |post| %>
|
5
|
+
|
6
|
+
<div class="title-box">
|
7
|
+
<p>
|
8
|
+
<%= link_to "#{post.title}", post_path(post.slug) %> <br/>
|
9
|
+
<span><small><em><%= time_ago_in_words(post.updated_at) %> ago</em></small></span>
|
10
|
+
</p>
|
11
|
+
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<div class="pagination-control text-center">
|
17
|
+
<%= paginate @posts %>
|
18
|
+
</div>
|
@@ -0,0 +1,147 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require_relative "ui_helpers"
|
3
|
+
require_relative "version"
|
4
|
+
require_relative "string_helpers"
|
5
|
+
require_relative "file_helpers"
|
6
|
+
require_relative "config_values"
|
7
|
+
|
8
|
+
module AuthBuilder
|
9
|
+
|
10
|
+
def self.build_auth(app_dir, options)
|
11
|
+
new_line(2)
|
12
|
+
wputs "----> Generating authentication scheme ...", :info
|
13
|
+
|
14
|
+
rbricks_dir = File.dirname(__FILE__)
|
15
|
+
add_string = ""
|
16
|
+
|
17
|
+
# Model
|
18
|
+
if options[:devise_config][:scheme] == "email"
|
19
|
+
FileUtils.cp_r(rbricks_dir + "/assets/models/devise_email/user.rb", app_dir + "/app/models")
|
20
|
+
else
|
21
|
+
FileUtils.cp_r(rbricks_dir + "/assets/models/devise_username/user.rb", app_dir + "/app/models")
|
22
|
+
end
|
23
|
+
wputs "--> User model created."
|
24
|
+
|
25
|
+
# Migration
|
26
|
+
if options[:devise_config][:scheme] == "email"
|
27
|
+
FileUtils.cp_r(rbricks_dir + "/assets/migrations/devise_email/20141010133701_devise_create_users.rb", app_dir + "/db/migrate")
|
28
|
+
else
|
29
|
+
FileUtils.cp_r(rbricks_dir + "/assets/migrations/devise_username/20141010133701_devise_create_users.rb", app_dir + "/db/migrate")
|
30
|
+
end
|
31
|
+
wputs "--> Migration created."
|
32
|
+
|
33
|
+
# Seeds
|
34
|
+
FileUtils.rm(app_dir + "/db/seeds.rb")
|
35
|
+
if options[:devise_config][:scheme] == "email"
|
36
|
+
if options[:devise_config][:test_users]
|
37
|
+
FileUtils.cp_r(rbricks_dir + "/assets/seeds/devise_email/seeds_test_users.rb", app_dir + "/db/seeds.rb")
|
38
|
+
else
|
39
|
+
FileUtils.cp_r(rbricks_dir + "/assets/seeds/devise_email/seeds_no_test_users.rb", app_dir + "/db/seeds.rb")
|
40
|
+
end
|
41
|
+
else
|
42
|
+
if options[:devise_config][:test_users]
|
43
|
+
FileUtils.cp_r(rbricks_dir + "/assets/seeds/devise_username/seeds_test_users.rb", app_dir + "/db/seeds.rb")
|
44
|
+
else
|
45
|
+
FileUtils.cp_r(rbricks_dir + "/assets/seeds/devise_username/seeds_no_test_users.rb", app_dir + "/db/seeds.rb")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
wputs "--> Seeds created."
|
49
|
+
|
50
|
+
# Admin Controllers
|
51
|
+
FileUtils.mkdir_p(app_dir + "/app/controllers/admin")
|
52
|
+
FileUtils.cp_r(rbricks_dir + "/assets/controllers/admin/base_controller.rb", app_dir + "/app/controllers/admin/base_controller.rb")
|
53
|
+
if options[:devise_config][:scheme] == "email"
|
54
|
+
FileUtils.cp_r(rbricks_dir + "/assets/controllers/admin/devise_email/users_controller.rb", app_dir + "/app/controllers/admin/users_controller.rb")
|
55
|
+
else
|
56
|
+
FileUtils.cp_r(rbricks_dir + "/assets/controllers/admin/devise_username/users_controller.rb", app_dir + "/app/controllers/admin/users_controller.rb")
|
57
|
+
end
|
58
|
+
wputs "--> User admin controllers created."
|
59
|
+
|
60
|
+
# Controllers
|
61
|
+
FileUtils.cp_r(rbricks_dir + "/assets/controllers/pages_controller.rb", app_dir + "/app/controllers/pages_controller.rb")
|
62
|
+
FileUtils.rm(app_dir + "/app/controllers/application_controller.rb")
|
63
|
+
if options[:devise_config][:scheme] == "email"
|
64
|
+
FileUtils.cp_r(rbricks_dir + "/assets/controllers/devise_email/application_controller.rb", app_dir + "/app/controllers/application_controller.rb")
|
65
|
+
else
|
66
|
+
FileUtils.cp_r(rbricks_dir + "/assets/controllers/devise_username/application_controller.rb", app_dir + "/app/controllers/application_controller.rb")
|
67
|
+
end
|
68
|
+
wputs "--> Controllers created."
|
69
|
+
|
70
|
+
# Admin Views
|
71
|
+
FileUtils.mkdir_p(app_dir + "/app/views/admin")
|
72
|
+
FileUtils.mkdir_p(app_dir + "/app/views/admin/base")
|
73
|
+
FileUtils.mkdir_p(app_dir + "/app/views/admin/users")
|
74
|
+
if options[:devise_config][:scheme] == "email"
|
75
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/admin/base/devise_email/index.html.erb", app_dir + "/app/views/admin/base")
|
76
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/admin/users/devise_email/index.html.erb", app_dir + "/app/views/admin/users")
|
77
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/admin/users/devise_email/edit.html.erb", app_dir + "/app/views/admin/users")
|
78
|
+
else
|
79
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/admin/base/devise_username/index.html.erb", app_dir + "/app/views/admin/base")
|
80
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/admin/users/devise_username/index.html.erb", app_dir + "/app/views/admin/users")
|
81
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/admin/users/devise_username/edit.html.erb", app_dir + "/app/views/admin/users")
|
82
|
+
end
|
83
|
+
wputs "--> Admin views created."
|
84
|
+
|
85
|
+
# Devise views
|
86
|
+
FileUtils.mkdir_p(app_dir + "/app/views/devise")
|
87
|
+
if options[:devise_config][:scheme] == "email"
|
88
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/devise/devise_email/.", app_dir + "/app/views/devise")
|
89
|
+
else
|
90
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/devise/devise_username/.", app_dir + "/app/views/devise")
|
91
|
+
end
|
92
|
+
wputs "--> Devise views created."
|
93
|
+
|
94
|
+
# Links views
|
95
|
+
FileUtils.rm(app_dir + "/app/views/layouts/_navigation_links.html.erb")
|
96
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/layouts/_navigation_links.html.erb", app_dir + "/app/views/layouts")
|
97
|
+
wputs "--> Navbar links created."
|
98
|
+
|
99
|
+
# Protected page
|
100
|
+
FileUtils.cp_r(rbricks_dir + "/assets/views/pages/inside.html.erb", app_dir + "/app/views/pages")
|
101
|
+
wputs "--> Protected view created."
|
102
|
+
|
103
|
+
# Devise initializer
|
104
|
+
if options[:devise_config][:scheme] == "email"
|
105
|
+
FileUtils.cp_r(rbricks_dir + "/assets/config/initializers/devise_email/devise.rb", app_dir + "/config/initializers")
|
106
|
+
else
|
107
|
+
FileUtils.cp_r(rbricks_dir + "/assets/config/initializers/devise_username/devise.rb", app_dir + "/config/initializers")
|
108
|
+
end
|
109
|
+
wputs "--> Devise initializer created."
|
110
|
+
|
111
|
+
# Routes
|
112
|
+
FileUtils.rm(app_dir + "/config/routes.rb")
|
113
|
+
FileUtils.cp_r(rbricks_dir + "/assets/config/routes.rb", app_dir + "/config")
|
114
|
+
wputs "--> Routes created."
|
115
|
+
|
116
|
+
# Allow signup
|
117
|
+
if options[:devise_config][:allow_signup]
|
118
|
+
FileHelpers.replace_string(/BRICK_ALLOW_SIGNUP/, ':registerable,', app_dir + "/app/models/user.rb")
|
119
|
+
FileHelpers.replace_string(/BRICK_ALLOW_SIGNUP_LINK/, '<li><%= link_to "Sign up", new_user_registration_path %></li>', app_dir + "/app/views/layouts/_navigation_links.html.erb")
|
120
|
+
FileHelpers.replace_string(/BRICK_ALLOW_EDIT_LINK/, '<li><%= link_to "Edit your account", edit_user_registration_path %></li>', app_dir + "/app/views/layouts/_navigation_links.html.erb")
|
121
|
+
FileHelpers.replace_string(/BRICK_ALLOW_SIGNUP_LINKS/, FileHelpers.get_file(:brick_allow_signup_links), app_dir + "/app/views/devise/shared/_links.erb")
|
122
|
+
else
|
123
|
+
FileHelpers.replace_string(/BRICK_ALLOW_SIGNUP/, '', app_dir + "/app/models/user.rb")
|
124
|
+
FileHelpers.replace_string(/BRICK_ALLOW_SIGNUP_LINK/, '', app_dir + "/app/views/layouts/_navigation_links.html.erb")
|
125
|
+
FileHelpers.replace_string(/BRICK_ALLOW_EDIT_LINK/, '', app_dir + "/app/views/layouts/_navigation_links.html.erb")
|
126
|
+
FileHelpers.replace_string(/BRICK_ALLOW_SIGNUP_LINKS/, '', app_dir + "/app/views/devise/shared/_links.erb")
|
127
|
+
end
|
128
|
+
wputs "--> User registration options set."
|
129
|
+
|
130
|
+
new_line
|
131
|
+
wputs "----> Authentication scheme generated.", :info
|
132
|
+
|
133
|
+
rescue
|
134
|
+
Errors.display_error("Something went wrong and the authentication scheme couldn't be generated. Stopping app creation.", true)
|
135
|
+
abort
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
def self.wputs(text, highlight = :none)
|
140
|
+
StringHelpers.wputs(text, highlight)
|
141
|
+
end
|
142
|
+
|
143
|
+
def self.new_line(lines=1)
|
144
|
+
StringHelpers.new_line(lines)
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|