sinatra-hexacta 0.8.5 → 0.9.1

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: 6d6be02726f449dec366288a8e986cf950a350412e36138a0081faae3de4d85f
4
- data.tar.gz: 4f7dcaeb8123ec8154b38a668cfb02205f44809583dd4d0eb39ee7dabcd447e7
3
+ metadata.gz: 2dada651b7cec1a5940f886d7c45529ec9bdab29c360e7dba9fe950eb1612997
4
+ data.tar.gz: 5e0c4fd134cb9e1067f4a81642562942f17f6a77441589e8d49e86d7606e3658
5
5
  SHA512:
6
- metadata.gz: f343d242e5d4683f1ef4a6e218024125b2095bb12f3245e18ec0f4d2288497b6b686bfa4815dca14ddeef452733e76339b214e61c78dd13ec8a7755cea896667
7
- data.tar.gz: 856b37635174175a17585071b60b5ac3151db247327afd8a44720876319cf0e2b5653209e1574756bbe25d1ae8a9659ab38074dc5330e2c4bd25618d107764b6
6
+ metadata.gz: 935449a6aa6763e9d572ee525c8c86f9b9864c430d72ceeddbe947711464fc05637a8c0801beb6b33e4d22257a903c99fd7cdf88ef4d9b2ef76100e4cdc5c35b
7
+ data.tar.gz: 0a43e306531dcea9a16e90201f43e0786e8acc0c0ceea015349855b5194233e99e72d2e0350ca3857942461fdfdb8758194c113e472e19c739f2bb937bc40dcb
@@ -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 initialize
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,43 +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();
33
65
  },
34
66
  error: function(error) {
67
+ ProcessManager.error();
35
68
  }
36
69
  });
37
70
  }
38
71
 
39
72
  static start_with_map(clazz,map) {
73
+ ProcessManager.show(clazz);
40
74
  map['class'] = clazz;
41
75
  $.ajax({
42
76
  url: "/process",
43
77
  type: 'POST',
44
78
  data: map,
45
79
  success: function(result) {
46
- ProcessManager.show('Cargando...');
47
- ProcessManager.update(0);
80
+ ProcessManager.init();
48
81
  },
49
82
  error: function(error) {
83
+ ProcessManager.error();
50
84
  }
51
85
  });
52
86
  }
@@ -58,18 +92,28 @@ class ProcessManager {
58
92
  data: { class : clazz },
59
93
  success: function(result) {
60
94
  if (result != "") {
95
+ ProcessManager.show(result.name);
61
96
  if (result.progress >= 100.0) {
62
- //ProcessManager.hide();
63
- ProcessManager.complete()
64
- ProcessManager.cleanProcess(clazz);
65
- } else {
66
- ProcessManager.show(result.name);
97
+ ProcessManager.completeProcess(clazz);
67
98
  }
68
99
  ProcessManager.update(result.progress);
69
-
70
100
  }
71
101
  },
72
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();
73
117
  }
74
118
  });
75
119
  }
@@ -79,8 +123,10 @@ class ProcessManager {
79
123
  url: "/processes/" + clazz,
80
124
  type: 'POST',
81
125
  success: function(result) {
126
+ ProcessManager.cancel();
82
127
  },
83
128
  error: function(error) {
129
+ ProcessManager.error();
84
130
  }
85
131
  });
86
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.5
4
+ version: 0.9.1
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