r5 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/README.md +69 -0
  4. data/Rakefile +2 -0
  5. data/bin/console +14 -0
  6. data/bin/r5 +4 -0
  7. data/bin/setup +7 -0
  8. data/lib/r5.rb +5 -0
  9. data/lib/r5/config.rb +12 -0
  10. data/lib/r5/installations/default.rb +53 -0
  11. data/lib/r5/installations/testing.rb +4 -0
  12. data/lib/r5/odin.rb +76 -0
  13. data/lib/r5/recipes/bootstrap.rb +9 -0
  14. data/lib/r5/recipes/bootstrap_app.rb +10 -0
  15. data/lib/r5/recipes/devise.rb +94 -0
  16. data/lib/r5/recipes/exception_notification.rb +10 -0
  17. data/lib/r5/recipes/gemfile.rb +41 -0
  18. data/lib/r5/recipes/gitignore.rb +8 -0
  19. data/lib/r5/recipes/install_questions.rb +20 -0
  20. data/lib/r5/recipes/lazy_high_charts.rb +18 -0
  21. data/lib/r5/recipes/mail_settings.rb +22 -0
  22. data/lib/r5/recipes/mysql.rb +22 -0
  23. data/lib/r5/recipes/rspec_generators.rb +18 -0
  24. data/lib/r5/recipes/upload_app.rb +9 -0
  25. data/lib/r5/recipes/wicked_pdf.rb +35 -0
  26. data/lib/r5/recipes/xlsx_support.rb +6 -0
  27. data/lib/r5/starter.rb +116 -0
  28. data/lib/r5/template/.ruby-version +1 -0
  29. data/lib/r5/template/app/assets/javascripts/main.js.rb +11 -0
  30. data/lib/r5/template/app/assets/stylesheets/custom.css.scss +128 -0
  31. data/lib/r5/template/app/assets/stylesheets/main.css.scss +7 -0
  32. data/lib/r5/template/app/assets/stylesheets/theme.css +7089 -0
  33. data/lib/r5/template/app/assets/stylesheets/timepress.css.scss +127 -0
  34. data/lib/r5/template/app/controllers/users_controller.rb +106 -0
  35. data/lib/r5/template/app/views/layouts/application.html.erb +64 -0
  36. data/lib/r5/template/app/views/users/_form.html.erb +64 -0
  37. data/lib/r5/template/app/views/users/edit.html.erb +10 -0
  38. data/lib/r5/template/app/views/users/edit_password.html.erb +49 -0
  39. data/lib/r5/template/app/views/users/index.html.erb +36 -0
  40. data/lib/r5/template/app/views/users/index.json.jbuilder +4 -0
  41. data/lib/r5/template/app/views/users/new.html.erb +9 -0
  42. data/lib/r5/template/app/views/users/show.html.erb +14 -0
  43. data/lib/r5/template/app/views/users/show.json.jbuilder +1 -0
  44. data/lib/r5/template/config/initializers/html_helpers.rb +99 -0
  45. data/lib/r5/template/config/locales/cs.yml +307 -0
  46. data/lib/r5/template/lib/tasks/bootstrap.rake +20 -0
  47. data/lib/r5/template/lib/tasks/upload.rake +24 -0
  48. data/lib/r5/version.rb +3 -0
  49. data/r5.gemspec +29 -0
  50. metadata +137 -0
@@ -0,0 +1,127 @@
1
+ @media (min-width: 1200px) {
2
+ .container-small {
3
+ width: 700px;
4
+ }
5
+ .container-large {
6
+ width: 1320px;
7
+ }
8
+ }
9
+
10
+ .container-small, .container-large {
11
+ max-width: 100%;
12
+ }
13
+
14
+ .table-responsive {
15
+ border-top: 1px solid #D0D3D4;
16
+ padding: 15px;
17
+ padding-bottom: 6px;
18
+ background: #fff;
19
+ }
20
+ .vertical-divider {
21
+ border-top: 1px solid #4E5D6C;
22
+ -webkit-box-shadow: inset 0px 1px 0px 0px rgba(78,93,108,1);
23
+ -moz-box-shadow: inset 0px 1px 0px 0px rgba(78,93,108,1);
24
+ box-shadow: inset 0px 1px 0px 0px rgba(198, 201, 203, 1);
25
+ }
26
+
27
+ .price-diff, .daylight-saving {
28
+ position: relative;
29
+ }
30
+
31
+ .price-diff:after {
32
+ content: " ";
33
+ width: 0;
34
+ height: 0;
35
+ position: absolute;
36
+ top: 8px;
37
+ left: 100%;
38
+ border-style: solid;
39
+ border-width: 4px 0 4px 5px;
40
+ border-color: transparent transparent transparent #eb2a2a;
41
+ }
42
+
43
+ .daylight-saving:after {
44
+ content: " ";
45
+ width: 0;
46
+ height: 0;
47
+ position: absolute;
48
+ top: 8px;
49
+ right: 0;
50
+ border-style: solid;
51
+ border-width: 4px 5px 4px 0;
52
+ border-color: transparent #31afd5 transparent transparent;
53
+ }
54
+
55
+ .period-select {
56
+ border-top: 1px solid #D0D3D4;
57
+ padding: 10px 15px;
58
+ background: #f0f0f0;
59
+ padding-bottom: 6px;
60
+ margin-bottom: 0px;
61
+ font-weight: 300;
62
+ overflow-x: auto;
63
+ white-space: nowrap;
64
+ .period-list {
65
+ overflow: auto;
66
+ }
67
+ span.year {
68
+ display: inline;
69
+ border-radius: 3px;
70
+ background: #4E5D6C;
71
+ color: #fff;
72
+ padding: 0 3px;
73
+ margin-right: 5px;
74
+ }
75
+ table {
76
+ a {
77
+ font-weight: 300;
78
+ color: #428bca;
79
+ display: inline;
80
+ }
81
+ a.active {
82
+ background: #DF691A;
83
+ color: white;
84
+ padding: 0 3px;
85
+ border-radius: 3px;
86
+ }
87
+ a:hover {
88
+ background: #31AFD5;
89
+ color: white;
90
+ padding: 0 3px;
91
+ border-radius: 3px;
92
+ text-decoration: none;
93
+ }
94
+ }
95
+ }
96
+
97
+
98
+ .period-select .mCSB_horizontal.mCSB_inside > .mCSB_container {
99
+ margin-bottom: 17px;
100
+ margin-right: 0;
101
+ }
102
+
103
+ .period-select.mCS_no_scrollbar .mCSB_horizontal.mCSB_inside > .mCSB_container {
104
+ margin-bottom: 0px;
105
+ }
106
+
107
+ .mCSB_scrollTools.mCSB_scrollTools_horizontal {
108
+ border-top: 1px dotted #D0D3D4;
109
+ padding-top: 5px;
110
+ height: 21px;
111
+ }
112
+
113
+ .period-select .mCSB_scrollTools.mCSB_scrollTools_horizontal {
114
+ border: none;
115
+ padding-top: 6px;
116
+ }
117
+
118
+ .mCSB_scrollTools.mCSB_scrollTools_horizontal a + .mCSB_draggerContainer {
119
+ margin-top: 6px;
120
+ }
121
+
122
+ .form {
123
+ background: #fff;
124
+ border-top: 1px solid #D0D3D4;
125
+ padding: 15px 0;
126
+ margin-bottom: 30px;
127
+ }
@@ -0,0 +1,106 @@
1
+ class UsersController < ApplicationController
2
+ before_action :set_user, only: [:show, :edit, :update, :destroy]
3
+ before_filter :only_for_admin, except: [:edit_own_password, :update_password]
4
+
5
+ # GET /users
6
+ # GET /users.json
7
+ def index
8
+ @users = User.all
9
+ end
10
+
11
+ # GET /users/1
12
+ # GET /users/1.json
13
+ def show
14
+ end
15
+
16
+ # GET /users/new
17
+ def new
18
+ @user = User.new
19
+ end
20
+
21
+ # GET /users/1/edit
22
+ def edit
23
+
24
+ end
25
+
26
+ def edit_password
27
+ @user = User.find(params[:id])
28
+ end
29
+
30
+ def edit_own_password
31
+ @user = current_user
32
+ render 'edit_password'
33
+ end
34
+
35
+ def update_password
36
+ @user = User.find(params[:id])
37
+ if @user.id == current_user.id
38
+ if @user.update_with_password(user_params)
39
+ sign_in @user, :bypass => true
40
+ redirect_to root_path
41
+ else
42
+ render 'edit_password'
43
+ end
44
+ else
45
+ if @user.update(user_params)
46
+ redirect_to root_path
47
+ else
48
+ render 'edit_password'
49
+ end
50
+ end
51
+ end
52
+
53
+ # POST /users
54
+ # POST /users.json
55
+ def create
56
+ @user = User.new(user_params)
57
+
58
+ respond_to do |format|
59
+ if @user.save
60
+ format.html { redirect_to users_url, notice: 'Uživatel byl uložen.' }
61
+ format.json { render :show, status: :created, location: @user }
62
+ else
63
+ format.html { render :new }
64
+ format.json { render json: @user.errors, status: :unprocessable_entity }
65
+ end
66
+ end
67
+ end
68
+
69
+ # PATCH/PUT /users/1
70
+ # PATCH/PUT /users/1.json
71
+ def update
72
+ respond_to do |format|
73
+ if @user.update(user_params)
74
+ format.html { redirect_to users_url, notice: 'Uživatel byl upraven.' }
75
+ format.json { render :show, status: :ok, location: @user }
76
+ else
77
+ format.html { render :edit }
78
+ format.json { render json: @user.errors, status: :unprocessable_entity }
79
+ end
80
+ end
81
+ end
82
+
83
+ # DELETE /users/1
84
+ # DELETE /users/1.json
85
+ def destroy
86
+ @user.destroy
87
+ respond_to do |format|
88
+ format.html { redirect_to users_url, notice: 'Uživatel byl odstraněn.' }
89
+ format.json { head :no_content }
90
+ end
91
+ end
92
+
93
+ private
94
+ # Use callbacks to share common setup or constraints between actions.
95
+ def set_user
96
+ @user = User.find(params[:id])
97
+ end
98
+
99
+
100
+
101
+ # Never trust parameters from the scary internet, only allow the white list through.
102
+ def user_params
103
+ params.required(:user).permit(:password, :password_confirmation, :current_password, :email,
104
+ :login, :firstname, :lastname)
105
+ end
106
+ end
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>PROJECT_NAME</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+ <meta name="description" content="">
8
+ <meta name="author" content="">
9
+
10
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
11
+ <!--[if lt IE 9]>
12
+ <%= javascript_include_tag "https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js", "https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js" %>
13
+ <![endif]-->
14
+
15
+ <%= favicon_link_tag 'favicon.png' %>
16
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
17
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
18
+ <%= csrf_meta_tags %>
19
+ </head>
20
+ <body>
21
+ <div class="navbar navbar-default navbar-fixed-top">
22
+ <div class="container container-large">
23
+ <div class="navbar-header">
24
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
25
+ <span class="sr-only">Toggle navigation</span>
26
+ <span class="icon-bar"></span>
27
+ <span class="icon-bar"></span>
28
+ <span class="icon-bar"></span>
29
+ </button>
30
+ </div>
31
+ <% if current_user %>
32
+ <div class="collapse navbar-collapse">
33
+ <ul class="nav navbar-nav">
34
+ <%= menu_item 'example', '#', /example(?!new)/ %>
35
+ </ul>
36
+ <ul class="nav navbar-nav navbar-right">
37
+ <li id="fat-menu" class="dropdown">
38
+ <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
39
+ <i class="icon-user"></i> <%= 'Přihlášen' %>: <%= current_user.display_name %>
40
+ <i class="icon-caret-down"></i>
41
+ </a>
42
+ <ul class="dropdown-menu">
43
+ <li><%= link_to 'Změnit heslo', {controller: 'users', action: 'edit_own_password'} , :tabindex => -1 %></li>
44
+ <li class="divider"></li>
45
+ <li><%= link_to 'Odhlásit', destroy_user_session_path, :method => :delete %></li>
46
+ </ul>
47
+ </li>
48
+ </ul>
49
+ </div>
50
+ <% end %>
51
+ </div>
52
+ </div>
53
+ <div class="container container-large content">
54
+ <% flash.each do |name, msg| %>
55
+ <%= content_tag :div, :class => "alert alert-#{ name == :error ? "danger" : "success" } alert-dismissable" do %>
56
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
57
+ <%= msg %>
58
+ <% end %>
59
+ <% end %>
60
+
61
+ <%= yield %>
62
+ </div>
63
+ </body>
64
+ </html>
@@ -0,0 +1,64 @@
1
+ <%= form_for(@user, :html => { :class => "form-horizontal" }) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div class="alert alert-danger alert-dismissable">
4
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
5
+ <ul>
6
+ <% @user.errors.messages.each do |msg| %>
7
+ <li><%= msg[1].first %></li>
8
+ <% end %>
9
+ </ul>
10
+ </div>
11
+ <% end %>
12
+
13
+ <div class="col-lg-8">
14
+ <div class="form-group">
15
+ <%= f.label :login, 'Login', :class => "col-sm-2 control-label" %>
16
+ <div class="col-sm-6">
17
+ <%= f.text_field :login, :class => "form-control" %>
18
+ </div>
19
+ </div>
20
+
21
+ <div class="form-group">
22
+ <%= f.label :email, 'E-mail', :class => "col-sm-2 control-label" %>
23
+ <div class="col-sm-6">
24
+ <%= f.text_field :email, :class => "form-control" %>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="form-group">
29
+ <%= f.label :firstname, 'Jméno', :class => "col-sm-2 control-label" %>
30
+ <div class="col-sm-6">
31
+ <%= f.text_field :firstname, :class => "form-control" %>
32
+ </div>
33
+ </div>
34
+
35
+ <div class="form-group">
36
+ <%= f.label :lastname, 'Příjmení', :class => "col-sm-2 control-label" %>
37
+ <div class="col-sm-6">
38
+ <%= f.text_field :lastname, :class => "form-control" %>
39
+ </div>
40
+ </div>
41
+
42
+ <% if params[:action] == 'new' || params[:action] == 'create' %>
43
+ <div class="form-group">
44
+ <%= f.label :password, 'Heslo', :class => "col-sm-2 control-label" %>
45
+ <div class="col-sm-4">
46
+ <%= f.password_field :password, :class => "form-control" %>
47
+ </div>
48
+ </div>
49
+
50
+ <div class="form-group">
51
+ <%= f.label :password_confirmation, 'Potvrzení hesla', :class => "col-sm-2 control-label" %>
52
+ <div class="col-sm-4">
53
+ <%= f.password_field :password_confirmation, :class => "form-control" %>
54
+ </div>
55
+ </div>
56
+ <% end %>
57
+
58
+ <div class="form-group">
59
+ <div class="col-sm-offset-2 col-sm-6">
60
+ <%= f.submit 'Uložit', class: 'btn btn-primary' %>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <div class="page-header">
2
+ <%= delete_button @user, 'Opravdu chcete uživatel odstranit?' %>
3
+ <%= link_to users_path, :class => 'btn btn-default' do %>
4
+ <span class="glyphicon glyphicon-list-alt"></span>
5
+ Zpět
6
+ <% end %>
7
+ <h1>Úprava uživatele</h1>
8
+ </div>
9
+
10
+ <%= render 'form' %>
@@ -0,0 +1,49 @@
1
+ <div class="page-header">
2
+ <% if @user.errors.any? %>
3
+ <div class="alert alert-danger alert-dismissable">
4
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
5
+ <ul>
6
+ <% @user.errors.messages.each do |msg| %>
7
+ <li><%= msg[1].first %></li>
8
+ <% end %>
9
+ </ul>
10
+ </div>
11
+ <% end %>
12
+
13
+ <h1>Změna hesla</h1>
14
+ </div>
15
+
16
+ <%= form_for(@user, url: { action: 'update_password', id: @user }, html: { class: "form-horizontal" } ) do |f| %>
17
+
18
+ <div class="col-lg-8">
19
+
20
+ <% unless current_user.admin? && @user.id != current_user.id%>
21
+ <div class="form-group">
22
+ <%= f.label :current_password, 'Současné heslo', :class => "col-sm-2 control-label" %>
23
+ <div class="col-sm-4">
24
+ <%= f.password_field :current_password, :class => "form-control" %>
25
+ </div>
26
+ </div>
27
+ <% end %>
28
+
29
+ <div class="form-group">
30
+ <%= f.label :password, 'Heslo', :class => "col-sm-2 control-label" %>
31
+ <div class="col-sm-4">
32
+ <%= f.password_field :password, :class => "form-control" %>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="form-group">
37
+ <%= f.label :password_confirmation, 'Potvrzení hesla', :class => "col-sm-2 control-label" %>
38
+ <div class="col-sm-4">
39
+ <%= f.password_field :password_confirmation, :class => "form-control" %>
40
+ </div>
41
+ </div>
42
+
43
+ <div class="form-group">
44
+ <div class="col-sm-offset-2 col-sm-4">
45
+ <%= f.submit 'Změnit heslo', class: 'btn btn-primary' %>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ <% end %>
@@ -0,0 +1,36 @@
1
+ <div class="page-header">
2
+ <%= link_to new_user_path, :class => 'btn btn-primary' do %>
3
+ <span class="glyphicon glyphicon-plus"></span>
4
+ Nový uživatel
5
+ <% end %>
6
+ <h1>Seznam uživatelů</h1>
7
+ </div>
8
+
9
+ <div class="table-responsive">
10
+ <table class="table table-striped table-bordered table-hover">
11
+ <thead>
12
+ <tr>
13
+ <th>E-mail</th>
14
+ <th>Login</th>
15
+ <th>Jméno</th>
16
+ <th>Příjmení</th>
17
+ <th>Admin</th>
18
+ <th>Poslední přihlášení</th>
19
+ <th colspan="2">Akce</th>
20
+ </tr>
21
+ </thead>
22
+
23
+ <tbody>
24
+ <%= content_tag_for(:tr, @users) do |user| %>
25
+ <td <%= 'style="font-weight:bold"'.html_safe if user.admin? %>><%= user.email %></td>
26
+ <td><%= user.login %></td>
27
+ <td><%= user.firstname %></td>
28
+ <td><%= user.lastname %></td>
29
+ <td><%= user.admin ? 'A' : '' %></td>
30
+ <td><%= lf user.last_sign_in_at, :format=>'long' %></td>
31
+ <td><%= link_to 'Upravit', edit_user_path(user) %></td>
32
+ <td><%= link_to 'Heslo', {action: 'edit_password', id: user} %></td>
33
+ <% end %>
34
+ </tbody>
35
+ </table>
36
+ </div>