sinatra-hexacta 0.8.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0befef98fe4dd879c83aa2bef032f9c14b0fd7d99827624d29eac4534410aa7
4
- data.tar.gz: 15ff5feba0286aa289d1c37a3a197d4d6ab21c0ca5cac8b7a715470b4c676bc7
3
+ metadata.gz: 6884934e4cc519d87597493303f9a125118d60297589eb52a70f12a17646a83d
4
+ data.tar.gz: aa29474ab59cac85241982115645260e091cae81d1a26478d6b7b09e928978a9
5
5
  SHA512:
6
- metadata.gz: 5f927ed2709ef6473f7931efc27846e0cb8c22733d54d0cc72db124ae5d20c6f50f9ca7590af33e7fb398993b4b5d75b775c6c993335561a0d1750bcc8d8a0cc
7
- data.tar.gz: 272264081fd19267b2faad9450f7085c27df83fe0031f9465ec28af67677abd6bceb74422788e9aaac0a9f90091d51aaa34df5edb0e4e41827479a25c09c62e7
6
+ metadata.gz: 39d714392cac7c9f2b0502530aa1041c7a8b6b1d7f41c7adcf574e7f96c3195f96159d3f539bcdcb0bbd5309a3a737324660ba5002892b0d59556b9aef59ce8d
7
+ data.tar.gz: 97812801c6f809c9265092fc445c79f6fa577adef853da00704647af74749e79daa941a217160c07797ab0d1f3456254c39351e1fd368fee77145971195d6ed5
@@ -7,3 +7,4 @@ require_relative 'mail'
7
7
  require_relative 'generalmail'
8
8
  require_relative 'mailbuilder'
9
9
  require_relative 'processmanager'
10
+ require_relative 'menu'
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ class MenuBuilder
3
+
4
+ def new
5
+ @elements = []
6
+ end
7
+
8
+ def dropdown(text,icon,submenu)
9
+ @elements << { :type => 'dropdown' , :text => text, :icon => icon, :link => submenu }
10
+ return self
11
+ end
12
+
13
+ def link(text,icon,link,target)
14
+ @elements << { :type => 'dropdown' , :text => text, :icon => icon, :link => link, :target => target }
15
+ return self
16
+ end
17
+
18
+ def modal(text,icon,link)
19
+ @elements << { :type => 'modal' , :text => text, :icon => icon, :link => link }
20
+ return self
21
+ end
22
+
23
+ def build
24
+ @elements
25
+ end
26
+
27
+ end
@@ -56,6 +56,10 @@ class ProcessHandler
56
56
  @interrupted = true
57
57
  end
58
58
 
59
+ def interrupted?
60
+ @interrupted
61
+ end
62
+
59
63
  def running?
60
64
  @total != @performed
61
65
  end
@@ -6,3 +6,4 @@ require_relative 'cas'
6
6
  require_relative 'schedule'
7
7
  require_relative 'alerts'
8
8
  require_relative 'reports'
9
+ require_relative 'menu'
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+ module Sinatra
3
+ module MenuHelper
4
+ extend Hexacta
5
+
6
+ def menu(option_hash)
7
+ slim "#{Hexacta::GEM_FILE_DIR}/menu/menu".to_sym, locals: option_hash
8
+ end
9
+
10
+ setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/menu")
11
+ copy_all_files("/lib/sinatra/views/menu","/app/views/#{Hexacta::GEM_FILE_DIR}/menu")
12
+ end
13
+
14
+ helpers MenuHelper
15
+ end
@@ -10,28 +10,77 @@ class ProcessManager {
10
10
  }
11
11
 
12
12
  static update(progress) {
13
- $("#processes .progress-bar").css("width",progress + "%");
13
+ if ($("#processes .progress").hasClass("active")) {
14
+ $("#processes .progress-bar").css("width",progress + "%");
15
+ }
16
+ }
17
+
18
+ static init() {
19
+ $("#processes .progress-bar").css("width","0%");
20
+ $("#processes .icon").addClass("rotating");
21
+ $("#processes .icon").removeClass("zmdi-check-circle").addClass("zmdi-settings");
22
+ $("#processes .progress").addClass("active");
23
+ $("#processes a").removeClass("hidden");
24
+ $("#processes .progress-bar").removeClass("progress-bar-success").removeClass("progress-bar-warning").removeClass("progress-bar-danger");
25
+ $("#processes .detail").html("Cargando...");
14
26
  }
15
27
 
16
28
  static complete() {
17
29
  $("#processes .progress-bar").css("width","100%");
18
- $("#processes .rotating").removeClass("rotating");
19
- $("#processes .zmdi").removeClass("zmdi-settings").addClass("zmdi-check-circle");
30
+ $("#processes .icon").removeClass("rotating");
31
+ $("#processes .icon").removeClass("zmdi-settings").addClass("zmdi-check-circle");
32
+ $("#processes a").addClass("hidden");
20
33
  $("#processes .progress").removeClass("active");
21
34
  $("#processes .progress-bar").addClass("progress-bar-success");
22
35
  $("#processes .detail").html("Completado. Refresca la pantalla para actualizar la información.");
23
36
  }
24
37
 
38
+ static error() {
39
+ $("#processes .progress-bar").css("width","100%");
40
+ $("#processes .icon").removeClass("rotating");
41
+ $("#processes .icon").removeClass("zmdi-settings").addClass("zmdi-check-circle");
42
+ $("#processes a").addClass("hidden");
43
+ $("#processes .progress").removeClass("active");
44
+ $("#processes .progress-bar").addClass("progress-bar-danger");
45
+ $("#processes .detail").html("Ha ocurrido un error.");
46
+ }
47
+
48
+ static cancel() {
49
+ $("#processes .progress-bar").css("width","100%");
50
+ $("#processes .icon").removeClass("rotating");
51
+ $("#processes a").addClass("hidden");
52
+ $("#processes .progress").removeClass("active");
53
+ $("#processes .progress-bar").addClass("progress-bar-warning");
54
+ $("#processes .detail").html("Proceso cancelado. Refresca la pantalla para actualizar la información.");
55
+ }
56
+
25
57
  static start(clazz) {
58
+ ProcessManager.show(clazz);
26
59
  $.ajax({
27
60
  url: "/process",
28
61
  type: 'POST',
29
62
  data: { class : clazz },
30
63
  success: function(result) {
31
- ProcessManager.show('Cargando...');
32
- ProcessManager.update(0);
64
+ ProcessManager.init();
65
+ },
66
+ error: function(error) {
67
+ ProcessManager.error();
68
+ }
69
+ });
70
+ }
71
+
72
+ static start_with_map(clazz,map) {
73
+ ProcessManager.show(clazz);
74
+ map['class'] = clazz;
75
+ $.ajax({
76
+ url: "/process",
77
+ type: 'POST',
78
+ data: map,
79
+ success: function(result) {
80
+ ProcessManager.init();
33
81
  },
34
82
  error: function(error) {
83
+ ProcessManager.error();
35
84
  }
36
85
  });
37
86
  }
@@ -43,18 +92,28 @@ class ProcessManager {
43
92
  data: { class : clazz },
44
93
  success: function(result) {
45
94
  if (result != "") {
95
+ ProcessManager.show(result.name);
46
96
  if (result.progress >= 100.0) {
47
- //ProcessManager.hide();
48
- ProcessManager.complete()
49
- ProcessManager.cleanProcess(clazz);
50
- } else {
51
- ProcessManager.show(result.name);
97
+ ProcessManager.completeProcess(clazz);
52
98
  }
53
99
  ProcessManager.update(result.progress);
54
-
55
100
  }
56
101
  },
57
102
  error: function(error) {
103
+ ProcessManager.error();
104
+ }
105
+ });
106
+ }
107
+
108
+ static completeProcess(clazz) {
109
+ $.ajax({
110
+ url: "/processes/" + clazz,
111
+ type: 'POST',
112
+ success: function(result) {
113
+ ProcessManager.complete()
114
+ },
115
+ error: function(error) {
116
+ ProcessManager.error();
58
117
  }
59
118
  });
60
119
  }
@@ -64,8 +123,10 @@ class ProcessManager {
64
123
  url: "/processes/" + clazz,
65
124
  type: 'POST',
66
125
  success: function(result) {
126
+ ProcessManager.cancel();
67
127
  },
68
128
  error: function(error) {
129
+ ProcessManager.error();
69
130
  }
70
131
  });
71
132
  }
@@ -1,11 +1,21 @@
1
1
  .row#processes style="height:0px;overflow: hidden;-webkit-transition: all 0.5s ease-in-out;-o-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;"
2
2
  .col-xs-12
3
3
  .progress.progress-striped.active style="height:80px;"
4
+ a.lv-item.p-20.p-absolute style="right: 1%;z-index: 10;" role="button" onclick="clean_process();"
5
+ .media
6
+ .pull-right
7
+ i.zmdi.zmdi-hc-3x.zmdi-close-circle.c-white
4
8
  .progress-bar aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" style="width: 0%;text-align:left;"
5
- .lv-item.p-20.p-fixed
9
+ .lv-item.p-20.p-absolute
6
10
  .media
7
11
  .pull-left
8
- i.zmdi.zmdi-hc-3x.zmdi-settings.c-white.rotating
12
+ i.zmdi.zmdi-hc-3x.zmdi-settings.c-white.rotating.icon
9
13
  .media-body
10
14
  .lv-title.c-white.title
11
- small.lv-small.c-white.detail Espera por favor...
15
+ small.lv-small.c-white.detail Espera por favor...
16
+
17
+
18
+ javascript:
19
+ function clean_process() {
20
+ console.log("Override 'clean_process' function");
21
+ }
@@ -29,7 +29,7 @@ link href="/sinatra-hexacta/vendors/daterangepicker/daterangepicker.css" rel="st
29
29
  link href="/sinatra-hexacta/vendors/fullcalendar/main.min.css" rel="stylesheet"
30
30
 
31
31
  /year calendar
32
- link href="/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.css" rel="stylesheet"
32
+ link href="/sinatra-hexacta/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.css" rel="stylesheet"
33
33
 
34
34
  /general app
35
35
  link href="/sinatra-hexacta/css/app.min.1.css?version=#{settings.version}" rel="stylesheet"
@@ -0,0 +1,42 @@
1
+ .actions-menu.m-b-20
2
+ .btn-group.p-fixed style="border-radius: 5px;z-index:5;"
3
+ -for item in menu
4
+ -if item[:type] == 'dropdown'
5
+ .btn-group
6
+ a.btn.btn-default.dropdown-toggle.waves-effect.btn-icon-text aria-expanded="true" data-toggle="dropdown" type="button"
7
+ i.zmdi class="zmdi-#{item[:icon]}"
8
+ | #{item[:text]}
9
+
10
+ ul.dropdown-menu role="menu" style="border-radius: 5px;"
11
+ -for subitem in item[:link]
12
+ -if subitem[:type] == 'link'
13
+ li
14
+ a.btn-icon-text href="#{subitem[:link]}" target="#{subitem[:target]}"
15
+ i.zmdi class="zmdi-#{subitem[:icon]}"
16
+ | #{subitem[:text]}
17
+
18
+ -if item[:type] == 'link'
19
+ a.btn.btn-default.waves-effect.btn-icon-text type="button" href="#{item[:link]}" target="#{item[:target]}"
20
+ i.zmdi class="zmdi-#{item[:icon]}"
21
+ | #{item[:text]}
22
+
23
+ -if item[:type] == 'modal'
24
+ a.btn.btn-default.waves-effect.btn-icon-text type="button" data-toggle="modal" data-target="#{item[:link]}"
25
+ i.zmdi class="zmdi-#{item[:icon]}"
26
+ | #{item[:text]}
27
+
28
+
29
+ css:
30
+ .actions-menu {
31
+ height: 38px;
32
+ }
33
+ .actions-menu a.btn {
34
+ padding: 10px;
35
+ border-radius: 5px;
36
+ border-left: 1px solid #eee;
37
+ }
38
+
39
+ .actions-menu a:hover {
40
+ background: #2196f3 !important;
41
+ color: white !important;
42
+ }
@@ -1,7 +1,7 @@
1
1
  a.lv-item style="padding:10px 15px;#{notification.pending?? 'background-color: #ECF9FF;' : ''}" role="button" onclick="#{notification.pending?? "read_notify(#{notification.id},'#{notification.link}');this.onclick=\'\'" : ''}" href="#{notification.pending?? '#' : notification.link}"
2
2
  .media
3
3
  .pull-left.text-center.p-r-15
4
- img.lv-img-sm alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}"
4
+ img.lv-img-sm alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
5
5
  br
6
6
  -if notification.label == 'error'
7
7
  .btn.btn-link.bgm-red.btn-xs style="font-size:6pt" #{notification.label}
@@ -5,7 +5,7 @@
5
5
  .card-header
6
6
  .media
7
7
  .pull-left
8
- img.lv-img alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}"
8
+ img.lv-img alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
9
9
  .media-body.m-t-5
10
10
  h2
11
11
  | #{notification.title}
@@ -10,7 +10,7 @@
10
10
  .col-xs-2
11
11
  .card.profile-view
12
12
  .pv-header.bgm-teal style="height:70px;"
13
- img.pv-main style="width: 100px;height: 100px;bottom: -50px;margin-left: -50px;" alt="" src="#{Configuration::USER_PHOTO_URL}#{user.hxt_id}"
13
+ img.pv-main style="width: 100px;height: 100px;bottom: -50px;margin-left: -50px;" alt="" src="#{Configuration::USER_PHOTO_URL}#{user.hxt_id}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
14
14
  .pv-body style="padding: 0 20px 10px;"
15
15
  h2 style="font-size:14px;font-weight: 500;"
16
16
  | #{user.first_name}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sucker_punch
@@ -80,6 +80,7 @@ files:
80
80
  - lib/sinatra/extensions/mail.rb
81
81
  - lib/sinatra/extensions/mailbuilder.rb
82
82
  - lib/sinatra/extensions/mailsender.rb
83
+ - lib/sinatra/extensions/menu.rb
83
84
  - lib/sinatra/extensions/notification.rb
84
85
  - lib/sinatra/extensions/processmanager.rb
85
86
  - lib/sinatra/handlers/errors.rb
@@ -94,6 +95,7 @@ files:
94
95
  - lib/sinatra/helpers/init.rb
95
96
  - lib/sinatra/helpers/inputs.rb
96
97
  - lib/sinatra/helpers/libraries.rb
98
+ - lib/sinatra/helpers/menu.rb
97
99
  - lib/sinatra/helpers/reports.rb
98
100
  - lib/sinatra/helpers/schedule.rb
99
101
  - lib/sinatra/hexacta.rb
@@ -203,6 +205,7 @@ files:
203
205
  - lib/sinatra/views/libraries/include_css.slim
204
206
  - lib/sinatra/views/libraries/include_js_after.slim
205
207
  - lib/sinatra/views/libraries/include_js_before.slim
208
+ - lib/sinatra/views/menu/menu.slim
206
209
  - lib/sinatra/views/notifications.slim
207
210
  - lib/sinatra/views/notifications/form.slim
208
211
  - lib/sinatra/views/notifications/item.slim