semantic-rails-ui 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/semantic-rails-ui/engine.rb +8 -0
- data/lib/semantic-rails-ui/version.rb +1 -1
- data/lib/templates/erb/scaffold/_form.html.erb +14 -0
- data/lib/templates/erb/scaffold/edit.html.erb +3 -0
- data/lib/templates/erb/scaffold/index.html.erb +31 -0
- data/lib/templates/erb/scaffold/new.html.erb +3 -0
- data/lib/templates/erb/scaffold/show.html.erb +11 -0
- data/lib/templates/rails/scaffold_controller/controller.rb +59 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdc4e3aec0f3cbe061bf4fa5da9593723c03639d
|
4
|
+
data.tar.gz: 3bda9c1ce2d87644a3a191e9f6b0d4a43d48b59b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 513886fbfdb710921509b133067b9e074b9f30a8d094911b012b57b72552211e1b0d6fa7f45f0a5c315e2e2dbdc92bc3e06e7d6de432e49a69b10c2d1cf9e40c
|
7
|
+
data.tar.gz: 0bf772fe8100a12733ba3bd0b3f32f91173e800d4024f0a9a8c04a4bab2b60da5cff9c91f46255a05c32c3a0384c75e37008bb65e30c577dbc6b7b7aa2090e95
|
@@ -8,5 +8,13 @@ module SemanticRailsUi
|
|
8
8
|
app.config.assets.paths.push File.join(engine_root, 'app/assets/javascripts')
|
9
9
|
app.config.assets.paths.push File.join(engine_root, 'app/assets/stylesheets')
|
10
10
|
end
|
11
|
+
|
12
|
+
config.generators do |g|
|
13
|
+
g.templates.unshift File::expand_path('../../templates', __FILE__)
|
14
|
+
g.stylesheets false
|
15
|
+
g.javascripts false
|
16
|
+
g.helper false
|
17
|
+
g.test_framework false
|
18
|
+
end
|
11
19
|
end
|
12
20
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%%= simple_form_for @<%= singular_table_name %>, url: url do |f| %>
|
2
|
+
<% attributes.each do |attribute| -%>
|
3
|
+
<% if attribute.password_digest? -%>
|
4
|
+
<div class='two fields'>
|
5
|
+
<%%= f.input :password, label: 'Password', placeholder: '******' %>
|
6
|
+
<%%= f.input :password_confirmation, label: 'Password (confirmation)', placeholder: '******' %>
|
7
|
+
</div>
|
8
|
+
<% else -%>
|
9
|
+
<%%= f.input :<%= attribute.column_name %> %>
|
10
|
+
<% end -%>
|
11
|
+
<% end -%>
|
12
|
+
<%%= f.button :submit %>
|
13
|
+
<%%= link_to 'Cancel', cancel_url, class: 'ui button' %>
|
14
|
+
<%% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%%= ui_icon_header '<%= plural_table_name.titleize %>', 'list' %>
|
2
|
+
|
3
|
+
<table class='ui striped table'>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
7
|
+
<th><%= attribute.human_name %></th>
|
8
|
+
<% end -%>
|
9
|
+
<th> </th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
14
|
+
<tr>
|
15
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
16
|
+
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
|
17
|
+
<% end -%>
|
18
|
+
<td>
|
19
|
+
<%%= link_to 'Show', <%= singular_table_name %>, class: 'ui tiny compact basic button' %>
|
20
|
+
<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'ui tiny compact basic button' %>
|
21
|
+
<%%= ui_delete_link 'Destroy', <%= singular_table_name %>, 'Are you sure?' %>
|
22
|
+
</td>
|
23
|
+
</tr>
|
24
|
+
<%% end %>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
27
|
+
|
28
|
+
<%%= link_to new_<%= singular_table_name %>_path, class: 'ui right floated primary labeled icon button' do %>
|
29
|
+
<i class='add circle icon'></i>
|
30
|
+
New <%= human_name %>
|
31
|
+
<%% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%%= ui_icon_header '<%= singular_table_name.titleize %>', 'info' %>
|
2
|
+
|
3
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
4
|
+
<p>
|
5
|
+
<strong><%= attribute.human_name %>:</strong>
|
6
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<% end -%>
|
10
|
+
<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'ui tiny compact basic button' %>
|
11
|
+
<%%= link_to 'Edit', <%= index_helper %>_path, class: 'ui tiny compact basic button' %>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<% if namespaced? -%>
|
2
|
+
require_dependency "<%= namespaced_path %>/application_controller"
|
3
|
+
<% end -%>
|
4
|
+
<% module_namespacing do -%>
|
5
|
+
class <%= controller_class_name %>Controller < ApplicationController
|
6
|
+
before_action :set_<%= singular_table_name %>, only: [:edit, :update, :destroy]
|
7
|
+
|
8
|
+
def index
|
9
|
+
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
end
|
14
|
+
|
15
|
+
def new
|
16
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name) %>
|
17
|
+
end
|
18
|
+
|
19
|
+
def edit
|
20
|
+
end
|
21
|
+
|
22
|
+
def create
|
23
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
24
|
+
|
25
|
+
if @<%= orm_instance.save %>
|
26
|
+
redirect_to <%= index_helper %>_url, success: <%= "'#{human_name} was successfully created.'" %>
|
27
|
+
else
|
28
|
+
render :new
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def update
|
33
|
+
if @<%= orm_instance.update("#{singular_table_name}_params") %>
|
34
|
+
redirect_to <%= index_helper %>_url, success: <%= "'#{human_name} was successfully updated.'" %>
|
35
|
+
else
|
36
|
+
render :edit
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy
|
41
|
+
@<%= orm_instance.destroy %>
|
42
|
+
redirect_to <%= index_helper %>_url, success: <%= "'#{human_name} was successfully destroyed.'" %>
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def set_<%= singular_table_name %>
|
48
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
49
|
+
end
|
50
|
+
|
51
|
+
def <%= "#{singular_table_name}_params" %>
|
52
|
+
<%- if attributes_names.empty? -%>
|
53
|
+
params[:<%= singular_table_name %>]
|
54
|
+
<%- else -%>
|
55
|
+
params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
|
56
|
+
<%- end -%>
|
57
|
+
end
|
58
|
+
end
|
59
|
+
<% end -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic-rails-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Jancev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -196,6 +196,12 @@ files:
|
|
196
196
|
- lib/semantic-rails-ui.rb
|
197
197
|
- lib/semantic-rails-ui/engine.rb
|
198
198
|
- lib/semantic-rails-ui/version.rb
|
199
|
+
- lib/templates/erb/scaffold/_form.html.erb
|
200
|
+
- lib/templates/erb/scaffold/edit.html.erb
|
201
|
+
- lib/templates/erb/scaffold/index.html.erb
|
202
|
+
- lib/templates/erb/scaffold/new.html.erb
|
203
|
+
- lib/templates/erb/scaffold/show.html.erb
|
204
|
+
- lib/templates/rails/scaffold_controller/controller.rb
|
199
205
|
- semantic-rails-ui.gemspec
|
200
206
|
homepage: https://github.com/igorj/semantic-rails-ui
|
201
207
|
licenses:
|