sinatra-hexacta 1.7.4 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sinatra/public/js/app.js +72 -58
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35a5abe8c678f588839389b8b76c45c6849c90678054e5c9ee6d725bdaea6bb4
4
- data.tar.gz: 9bb209941df45a2f736cf559c85e6bb8c695bf5e9a0da54008020b1d42b741ac
3
+ metadata.gz: 326038800963651e5110e57becda6fe6def583a128d67e946ceebfface2bb5d5
4
+ data.tar.gz: 1e9cd82e1d24e38a5bb98af74157d50f4da20864b98dc0bd5b626c8bbbf7defa
5
5
  SHA512:
6
- metadata.gz: 3d53304326eeb461dc0f7276461b80241a06fbbc84468250b1bd65e2cea9a2f37f805414a5d6b3492576e69fda15548eeb84c9c2ec475b4886df8bb3f8b12eb2
7
- data.tar.gz: 332e75bb6823fe6c40a50aeb3b89f5e42d3f15ad60a953b71a4abb08fdacfd9f81c5d8d209f217d4ac94660b2ecbc75e8f93040bb54c544b05759b83e8ec6dd1
6
+ metadata.gz: 04ae027cd06846f2368a00eae03f326154cd61e1b0906f504ddd8674aafb9d19fd47f73f69a3de624341729d8b3f34b347d5c463b4a9db7cf56664ef44a5b5a7
7
+ data.tar.gz: 0b995bd3cc3d1dae76c29371b6503073f5479004a64232f6c17e98b0694b7e8627ab715999fec09d3927e2b07b0cc9e6bb5ec3b7f57cfea0c47b91dd7554ceca
@@ -27,6 +27,31 @@ function update_html_elements() {
27
27
 
28
28
  $("form.async").unbind("submit").submit(function(e){
29
29
  e.preventDefault();
30
+
31
+
32
+ $(this).find(':input[required]').each(function() {
33
+ if ($(this).val() == "" || $(this).val() == null) {
34
+ $(this).parent().removeClass("success");
35
+ $(this).parent().addClass("error");
36
+ } else {
37
+ $(this).parent().removeClass("error");
38
+ $(this).parent().addClass("success");
39
+ }
40
+ });
41
+
42
+ $(this).find('.chosen[required]').each(function() {
43
+ if ($(this).val() == "" || $(this).val() == null) {
44
+ $(this).parent().removeClass("success");
45
+ $(this).parent().addClass("error");
46
+ } else {
47
+ $(this).parent().removeClass("error");
48
+ $(this).parent().addClass("success");
49
+ }
50
+ });
51
+ if ($(this).find('.error').length > 0 ) {
52
+ return;
53
+ }
54
+
30
55
  var datastring = $(this).serialize();
31
56
  var url = $(this).attr('action');
32
57
  $(this).closest('.modal').modal('hide');
@@ -125,63 +150,6 @@ function update_html_elements() {
125
150
  }
126
151
  }
127
152
 
128
- /*
129
- * Sidebar
130
- */
131
- (function(){
132
- //Toggle
133
- $('body').on('click', '#menu-trigger', function(e){
134
- e.preventDefault();
135
- var x = $(this).data('trigger');
136
-
137
- $(x).toggleClass('toggled');
138
- $(this).toggleClass('open');
139
-
140
- //Close opened sub-menus
141
- $('.sub-menu.toggled').not('.active').each(function(){
142
- $(this).removeClass('toggled');
143
- $(this).find('ul').hide();
144
- });
145
-
146
- $('.profile-menu .main-menu').hide();
147
-
148
- if (x == '#sidebar') {
149
-
150
- $elem = '#sidebar';
151
- $elem2 = '#menu-trigger';
152
-
153
- $('#chat-trigger').removeClass('open');
154
-
155
- if (!$('#chat').hasClass('toggled')) {
156
- $('#header').toggleClass('sidebar-toggled');
157
- }
158
- else {
159
- $('#chat').removeClass('toggled');
160
- }
161
- }
162
-
163
- //When clicking outside
164
- if ($('#header').hasClass('sidebar-toggled')) {
165
- $(document).on('click', function (e) {
166
- if (($(e.target).closest($elem).length === 0) && ($(e.target).closest($elem2).length === 0)) {
167
- setTimeout(function(){
168
- $($elem).removeClass('toggled');
169
- $('#header').removeClass('sidebar-toggled');
170
- $($elem2).removeClass('open');
171
- });
172
- }
173
- });
174
- }
175
- })
176
-
177
- //Submenu
178
- $('body').on('click', '.sub-menu > a', function(e){
179
- e.preventDefault();
180
- $(this).next().slideToggle(200);
181
- $(this).parent().toggleClass('toggled');
182
- });
183
- })();
184
-
185
153
  /*
186
154
  * Clear Notification
187
155
  */
@@ -539,6 +507,48 @@ function update_html_elements() {
539
507
  $(this).find(':submit').attr("disabled",false);
540
508
  });
541
509
 
510
+ /*
511
+ * Sidebar
512
+ */
513
+ (function(){
514
+ //Toggle
515
+ $('#menu-trigger').unbind('click').on('click', function(e){
516
+ e.preventDefault();
517
+ var x = $(this).data('trigger');
518
+
519
+ $(x).toggleClass('toggled');
520
+ $(this).toggleClass('open');
521
+
522
+ //Close opened sub-menus
523
+ $('.sub-menu.toggled').not('.active').each(function(){
524
+ $(this).removeClass('toggled');
525
+ $(this).find('ul').hide();
526
+ });
527
+
528
+ $('.profile-menu .main-menu').hide();
529
+
530
+ //When clicking outside
531
+ if ($('#header').hasClass('sidebar-toggled')) {
532
+ $(document).on('click', function (e) {
533
+ if (($(e.target).closest($elem).length === 0) && ($(e.target).closest($elem2).length === 0)) {
534
+ setTimeout(function(){
535
+ $($elem).removeClass('toggled');
536
+ $('#header').removeClass('sidebar-toggled');
537
+ $($elem2).removeClass('open');
538
+ });
539
+ }
540
+ });
541
+ }
542
+ })
543
+
544
+ //Submenu
545
+ $('.sub-menu > a').unbind('click').on('click', function(e){
546
+ e.preventDefault();
547
+ $(this).next().slideToggle(200);
548
+ $(this).parent().toggleClass('toggled');
549
+ });
550
+
551
+ })();
542
552
  }
543
553
 
544
554
  const elementToObserve = document.querySelector("body");
@@ -670,5 +680,9 @@ function read_notify(id,url) {
670
680
  }
671
681
 
672
682
  function capitalize(word) {
673
- return word[0].toUpperCase() + word.slice(1).toLowerCase();
683
+ if (word == "") {
684
+ return "";
685
+ } else {
686
+ return word[0].toUpperCase() + word.slice(1).toLowerCase();
687
+ }
674
688
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger