Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/generators/draft/account/account_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def authentication_helpers

before_action(:load_current_#{singular_table_name.underscore})

# Uncomment this if you want to force #{plural_table_name} to sign in before any other actions
# Uncomment the "before_action" if you want to force #{plural_table_name} to sign in before any other actions
# Remember to also uncomment the "skip_before_action" in the corresponding authentication controller
Copy link
Contributor

@raghubetina raghubetina Dec 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the comment could be made even more direct with something like in <%= class_name.singularize %>AuthenticationController" rather than "in the corresponding authentication controller"?

# before_action(:force_#{singular_table_name.underscore}_sign_in)

def load_current_#{singular_table_name.underscore}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class <%= class_name.singularize %>AuthenticationController < ApplicationController
# Uncomment this if you want to force <%= plural_table_name %> to sign in before any other actions
# skip_before_action(:force_<%= singular_table_name.underscore %>_sign_in, { :only => [:sign_up_form, :create, :sign_in_form, :create_cookie] })

# Remember to also uncomment the "before_action" in the ApplicationController

def sign_in_form
render({ :template => "<%= singular_table_name.underscore %>_authentication/sign_in.html.erb" })
end
Expand Down
21 changes: 6 additions & 15 deletions lib/generators/draft/resource/templates/views/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<div>
<div>
<h1>
List of all <%= plural_table_name.humanize.downcase %>
</h1>
</div>
</div>
<h1>
List of all <%= plural_table_name.humanize.downcase %>
</h1>


<hr>

<div>
<div>
<h2>
Add a new <%= singular_table_name.humanize.downcase %>
</h2>
Expand Down Expand Up @@ -50,8 +45,7 @@
Create <%= singular_table_name.humanize.downcase %>
</button>
</form>
</div>
</div>


<hr>
<% if with_sentinels? -%>
Expand All @@ -66,8 +60,7 @@
<hr>

<% end -%>
<div>
<div>

<table>
<tr>
<th>
Expand Down Expand Up @@ -142,7 +135,5 @@
</tr>
<%% end %>
</table>
</div>
</div>

<hr>
24 changes: 8 additions & 16 deletions lib/generators/draft/resource/templates/views/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<div>
<div>
<h1>
<%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %> details
</h1>

<div>
<h1>
<%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %> details
</h1>


<div>
<a href="/<%= plural_table_name %>">
Go back
Expand All @@ -24,7 +23,6 @@
<!-- Delete link <%= singular_table_name %> end -->
<% end -%>
<% end -%>
</div>

<dl>
<% attributes.each do |attribute| -%>
Expand Down Expand Up @@ -68,8 +66,6 @@
<!-- Display updated_at end -->
<% end -%>
</dl>
</div>
</div>

<hr>

Expand All @@ -79,11 +75,9 @@
<!-- Show Page Customization end -->
<% end -%>

<div>
<div>
<h2>
Edit <%= singular_table_name.humanize.downcase %>
</h2>
<h2>
Edit <%= singular_table_name.humanize.downcase %>
</h2>

<form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" <% unless skip_post? -%> method="post" <% end -%>>
<% attributes.each do |attribute| -%>
Expand Down Expand Up @@ -124,7 +118,5 @@
Update <%= singular_table_name.humanize.downcase %>
</button>
</form>
</div>
</div>

<hr>