r5 0.2.0 → 0.2.3
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/r5/installations/default.rb +1 -0
- data/lib/r5/recipes/timepress_specifics.rb +26 -0
- data/lib/r5/starter.rb +5 -0
- data/lib/r5/template/config/initializers/html_helpers.rb +1 -1
- data/lib/r5/template/config/initializers/time_formats.rb +1 -0
- data/lib/r5/template/lib/templates/erb/scaffold/_form.html.erb +37 -0
- data/lib/r5/template/lib/templates/erb/scaffold/edit.html.erb +6 -0
- data/lib/r5/template/lib/templates/erb/scaffold/index.html.erb +29 -0
- data/lib/r5/template/lib/templates/erb/scaffold/new.html.erb +5 -0
- data/lib/r5/template/lib/templates/erb/scaffold/show.html.erb +19 -0
- data/lib/r5/template/lib/templates/rails/scaffold_controller/controller.rb +62 -0
- data/lib/r5/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f1fb2694e5a8ff8f54db38b5adafcea2461f9c3
|
4
|
+
data.tar.gz: 067a07403ccee9dd1461f3bea6dfc0de440deb27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20661a67b4d48fc0591cf01a492ab13934a23e5dae925b0570d99e1ddb914f40510088fd2f6ddd7bb5e282331923d71e326695fa68da6fb7fcdb7f56cd067dd8
|
7
|
+
data.tar.gz: 9b23a5f4f1b22021bfb167c7013cac85cdd82cd9d7dfd1a0ca3bb3088c5f9f3edbf706ea74395899bfc6ecac9ed225a9de8e760a80834912a39512f9793efb4d
|
@@ -40,6 +40,7 @@ layout_file = "#{@project_path}/app/views/layouts/application.html.erb"
|
|
40
40
|
remove 'app/views/layouts/application.html.erb'
|
41
41
|
copy 'app/views/layouts/application.html.erb'
|
42
42
|
apply 'recipes/mail_settings.rb'
|
43
|
+
apply 'recipes/timepress_generators.rb'
|
43
44
|
gsub_file layout_file, 'PROJECT_NAME', @project_name
|
44
45
|
apply 'recipes/gitignore.rb'
|
45
46
|
run 'git init'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
FileUtils.rm_rf("#{@project_path}/lib/templates")
|
2
|
+
my_directory 'lib/templates'
|
3
|
+
insert_into_file "#{@project_path}/app/assets/javascripts/application.js",
|
4
|
+
after: "//= require jquery_ujs\n" do <<-TXT
|
5
|
+
//= require jquery-ui/datepicker
|
6
|
+
TXT
|
7
|
+
end
|
8
|
+
|
9
|
+
copy 'config/initializers/time_formats.rb'
|
10
|
+
|
11
|
+
insert_into_file "#{@project_path}/app/assets/stylesheets/application.css",
|
12
|
+
before: "\n *= require_tree ." do <<-TXT
|
13
|
+
*= require jquery-ui/datepicker
|
14
|
+
TXT
|
15
|
+
end
|
16
|
+
|
17
|
+
create_file "#{@project_path}/app/assets/javascripts/custom.js.erb" do
|
18
|
+
<<-JS
|
19
|
+
var ready;
|
20
|
+
ready = function() {
|
21
|
+
$(".datepicker").datepicker({ dateFormat: 'dd. mm. yy'});
|
22
|
+
};
|
23
|
+
// Fire javascript after turbolinks event
|
24
|
+
$(document).on('turbolinks:load', ready);
|
25
|
+
JS
|
26
|
+
end
|
data/lib/r5/starter.rb
CHANGED
@@ -58,6 +58,11 @@ class Starter < Thor
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
desc 'add_timepress_specifics', 'add datepicker and other timepress specific things'
|
62
|
+
def add_timepress_specifics
|
63
|
+
apply 'recipes/timepress_specifics.rb'
|
64
|
+
end
|
65
|
+
|
61
66
|
desc 'add_wicked_pdf', 'add pdf generation to project'
|
62
67
|
def add_wicked_pdf
|
63
68
|
apply 'recipes/wicked_pdf.rb'
|
@@ -86,7 +86,7 @@ module ApplicationHelper
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def delete_button objekt, text
|
89
|
-
link_to '
|
89
|
+
link_to 'Delete', objekt, method: :delete, data: { confirm: text }, class: 'btn btn-danger pull-right' if params[:action] == 'edit'
|
90
90
|
end
|
91
91
|
|
92
92
|
def session_debug
|
@@ -0,0 +1 @@
|
|
1
|
+
Date::DATE_FORMATS[:default] = "%d. %m. %Y"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%%= form_for(@<%= singular_table_name %>, html: { class: "form-horizontal", role: "form" }) do |f| %>
|
2
|
+
<%% if @<%= singular_table_name %>.errors.any? %>
|
3
|
+
<div class="alert alert-danger alert-dismissable" role="alert">
|
4
|
+
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
5
|
+
<h4><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h4>
|
6
|
+
|
7
|
+
<ul>
|
8
|
+
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
9
|
+
<li><%%= msg %></li>
|
10
|
+
<%% end %>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
<%% end %>
|
14
|
+
|
15
|
+
<% attributes.each do |attribute| -%>
|
16
|
+
<% if attribute.field_type == :date_select %>
|
17
|
+
<div class="form-group">
|
18
|
+
<%%= f.label :<%= attribute.name %>, class: "col-sm-2 control-label" %>
|
19
|
+
<div class="col-sm-10">
|
20
|
+
<%%= f.text_field :<%= attribute.name %>, class: "form-control datepicker" %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<% else %>
|
24
|
+
<div class="form-group">
|
25
|
+
<%%= f.label :<%= attribute.name %>, class: "col-sm-2 control-label" %>
|
26
|
+
<div class="col-sm-10">
|
27
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: "form-control" %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
<% end -%>
|
32
|
+
<div class="form-group">
|
33
|
+
<div class="col-sm-offset-2 col-sm-10">
|
34
|
+
<%%= f.submit 'Save', class: "btn btn-primary" %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<%% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<%%= link_to new_<%= singular_table_name %>_path, class: 'btn btn-primary' do %>
|
3
|
+
<span class="glyphicon glyphicon-plus"></span>
|
4
|
+
New <%= human_name %>
|
5
|
+
<%% end %>
|
6
|
+
<h1>Listing <%= plural_table_name %></h1>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="table-responsive">
|
10
|
+
<table class="table table-striped table-bordered table-hover">
|
11
|
+
<thead>
|
12
|
+
<tr>
|
13
|
+
<% attributes.each do |attribute| -%>
|
14
|
+
<th><%= attribute.human_name %></th>
|
15
|
+
<% end -%>
|
16
|
+
<th></th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
|
20
|
+
<tbody>
|
21
|
+
<%%= content_tag_for(:tr, @<%= plural_table_name %>) do |<%= singular_table_name %>| %>
|
22
|
+
<% attributes.each do |attribute| -%>
|
23
|
+
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
|
24
|
+
<% end -%>
|
25
|
+
<td><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
|
26
|
+
<%% end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<%%= link_to <%= index_helper %>_path, class: 'btn btn-default' do %>
|
3
|
+
<span class="glyphicon glyphicon-list-alt"></span>
|
4
|
+
Back
|
5
|
+
<%% end %>
|
6
|
+
<%%= link_to edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'btn btn-primary' do %>
|
7
|
+
<span class="glyphicon glyphicon-pencil"></span>
|
8
|
+
Edit
|
9
|
+
<%% end %>
|
10
|
+
<h1>Show <%= singular_table_name %></h1>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<dl class="dl-horizontal">
|
14
|
+
<%- attributes.each do |attribute| -%>
|
15
|
+
<dt><%= attribute.human_name %>:</dt>
|
16
|
+
<dd><%%= @<%= singular_table_name %>.<%= attribute.name %> %></dd>
|
17
|
+
|
18
|
+
<%- end -%>
|
19
|
+
</dl>
|
@@ -0,0 +1,62 @@
|
|
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: [:show, :edit, :update, :destroy]
|
7
|
+
# GET <%= route_url %>
|
8
|
+
def index
|
9
|
+
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
10
|
+
end
|
11
|
+
# GET <%= route_url %>/1
|
12
|
+
def show
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET <%= route_url %>/new
|
16
|
+
def new
|
17
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name) %>
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET <%= route_url %>/1/edit
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST <%= route_url %>
|
25
|
+
def create
|
26
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
27
|
+
|
28
|
+
if @<%= orm_instance.save %>
|
29
|
+
redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully created.'" %>
|
30
|
+
else
|
31
|
+
render :new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
# PATCH/PUT <%= route_url %>/1
|
35
|
+
def update
|
36
|
+
if @<%= orm_instance.update("#{singular_table_name}_params") %>
|
37
|
+
redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully updated.'" %>
|
38
|
+
else
|
39
|
+
render :edit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# DELETE <%= route_url %>/1
|
43
|
+
def destroy
|
44
|
+
@<%= orm_instance.destroy %>
|
45
|
+
redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully destroyed.'" %>
|
46
|
+
end
|
47
|
+
private
|
48
|
+
# Use callbacks to share common setup or constraints between actions.
|
49
|
+
def set_<%= singular_table_name %>
|
50
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
51
|
+
end
|
52
|
+
|
53
|
+
# Only allow a trusted parameter "white list" through.
|
54
|
+
def <%= "#{singular_table_name}_params" %>
|
55
|
+
<%- if attributes_names.empty? -%>
|
56
|
+
params.fetch(:<%= singular_table_name %>, {})
|
57
|
+
<%- else -%>
|
58
|
+
params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
|
59
|
+
<%- end -%>
|
60
|
+
end
|
61
|
+
end
|
62
|
+
<% end -%>
|
data/lib/r5/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mousse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/r5/recipes/mail_settings.rb
|
85
85
|
- lib/r5/recipes/mysql.rb
|
86
86
|
- lib/r5/recipes/rspec_generators.rb
|
87
|
+
- lib/r5/recipes/timepress_specifics.rb
|
87
88
|
- lib/r5/recipes/upload_app.rb
|
88
89
|
- lib/r5/recipes/wicked_pdf.rb
|
89
90
|
- lib/r5/recipes/xlsx_support.rb
|
@@ -109,9 +110,16 @@ files:
|
|
109
110
|
- lib/r5/template/app/views/users/show.html.erb
|
110
111
|
- lib/r5/template/app/views/users/show.json.jbuilder
|
111
112
|
- lib/r5/template/config/initializers/html_helpers.rb
|
113
|
+
- lib/r5/template/config/initializers/time_formats.rb
|
112
114
|
- lib/r5/template/config/locales/cs.yml
|
113
115
|
- lib/r5/template/lib/tasks/bootstrap.rake
|
114
116
|
- lib/r5/template/lib/tasks/upload.rake
|
117
|
+
- lib/r5/template/lib/templates/erb/scaffold/_form.html.erb
|
118
|
+
- lib/r5/template/lib/templates/erb/scaffold/edit.html.erb
|
119
|
+
- lib/r5/template/lib/templates/erb/scaffold/index.html.erb
|
120
|
+
- lib/r5/template/lib/templates/erb/scaffold/new.html.erb
|
121
|
+
- lib/r5/template/lib/templates/erb/scaffold/show.html.erb
|
122
|
+
- lib/r5/template/lib/templates/rails/scaffold_controller/controller.rb
|
115
123
|
- lib/r5/version.rb
|
116
124
|
- r5.gemspec
|
117
125
|
homepage: http://www.timepress.cz
|