Skip to content
This repository
Browse code

Added turbolinks back in; refactored all JS functions to bind to page…

…:change event as well as document.ready
  • Loading branch information...
commit cdc10758a278573e5a1c7e7729a35ece31bfb91c 1 parent b1e4ac6
brzaik brzaik authored
1  Gemfile
@@ -30,6 +30,7 @@ group :assets do
30 30 end
31 31
32 32 gem 'jquery-rails'
  33 +gem 'turbolinks'
33 34 gem 'jquery-timepicker-rails'
34 35
35 36 # In production we prefer MySQL over sqlite3. If you are only
2  Gemfile-reporting
@@ -2,4 +2,4 @@
2 2 gem 'airbrake'
3 3
4 4 #Girl Friday makes Airbrake async.
5   -gem 'girl_friday'
  5 +gem 'girl_friday'
19 Gemfile.lock
@@ -55,7 +55,7 @@ GEM
55 55 daemons (1.1.9)
56 56 delayed_job (3.0.5)
57 57 activesupport (~> 3.0)
58   - delayed_job_active_record (0.4.0)
  58 + delayed_job_active_record (0.4.1)
59 59 activerecord (>= 2.1.0, < 4)
60 60 delayed_job (~> 3.0)
61 61 devise (2.2.3)
@@ -77,21 +77,21 @@ GEM
77 77 thor (>= 0.14, < 2.0)
78 78 jquery-timepicker-rails (0.2.0)
79 79 railties (>= 3.1.0)
80   - json (1.7.6)
  80 + json (1.7.7)
81 81 libv8 (3.11.8.13)
82 82 mail (2.4.4)
83 83 i18n (>= 0.4.0)
84 84 mime-types (~> 1.16)
85 85 treetop (~> 1.4.8)
86   - mime-types (1.19)
87   - multi_json (1.5.0)
  86 + mime-types (1.21)
  87 + multi_json (1.6.1)
88 88 mysql2 (0.3.11)
89 89 orm_adapter (0.4.0)
90 90 polyglot (0.3.3)
91   - rack (1.4.4)
  91 + rack (1.4.5)
92 92 rack-cache (1.2)
93 93 rack (>= 0.4)
94   - rack-ssl (1.3.2)
  94 + rack-ssl (1.3.3)
95 95 rack
96 96 rack-test (0.6.2)
97 97 rack (>= 1.0)
@@ -113,7 +113,7 @@ GEM
113 113 rdoc (~> 3.4)
114 114 thor (>= 0.14.6, < 2.0)
115 115 rake (10.0.3)
116   - rdoc (3.12)
  116 + rdoc (3.12.1)
117 117 json (~> 1.4)
118 118 ref (1.0.2)
119 119 rmagick (2.13.2)
@@ -135,7 +135,7 @@ GEM
135 135 rack (~> 1.0)
136 136 tilt (~> 1.1, != 1.3.0)
137 137 sqlite3 (1.3.7)
138   - strong_parameters (0.1.6)
  138 + strong_parameters (0.2.0)
139 139 actionpack (~> 3.0)
140 140 activemodel (~> 3.0)
141 141 railties (~> 3.0)
@@ -148,6 +148,8 @@ GEM
148 148 treetop (1.4.12)
149 149 polyglot
150 150 polyglot (>= 0.3.1)
  151 + turbolinks (1.0.0)
  152 + coffee-rails
151 153 tzinfo (0.3.35)
152 154 uglifier (1.3.0)
153 155 execjs (>= 0.3.0)
@@ -182,4 +184,5 @@ DEPENDENCIES
182 184 strong_parameters
183 185 sys-proctable
184 186 therubyracer
  187 + turbolinks
185 188 uglifier (>= 1.0.3)
68 app/assets/javascripts/application.js
@@ -12,74 +12,10 @@
12 12 //
13 13 //= require jquery
14 14 //= require jquery_ujs
  15 +//= require turbolinks
  16 +// require jquery.turbolinks
15 17 //= require jquery-ui
16 18 //= require html5_shiv/html5
17 19 //= require jquery.qtip.min
18 20 //= require jquery.timepicker.js
19 21 //= require_tree .
20   -
21   -// require turbolinks
22   -// require jquery.turbolinks
23   -
24   -$(document).ready(function () {
25   -
26   - // flash-banner display animation:
27   - if ( $("#flash-banner").html() !== "" ) {
28   - $(function () {
29   - var topmenuHeight = $("#top-menu").height();
30   - $("#flash-banner").animate({
31   - top: '+=' + topmenuHeight
32   - }, 1000, function() {
33   - // first animation is complete, so move it back up after 4 seconds:
34   - $("#flash-banner").delay(4000).animate({
35   - top: '0'
36   - }, 1000, function() {});
37   - });
38   - });
39   - }
40   -
41   -});
42   -
43   -// intitialization of qTip for basic tooltips:
44   -// this means that tooltips can be used on any page for single-line messages
45   -$(document).delegate(".tooltip-basic", "mouseover", function(event) {
46   - $(this).qtip({
47   - content: {
48   - text: $(this).attr('data-tooltip-text')
49   - },
50   - position: {
51   - at: 'bottom center', // Position the tooltip below the link
52   - my: 'top center',
53   - viewport: $(window) // Keep the tooltip on-screen at all times
54   - },
55   - show: {
56   - event: 'mouseenter', // Show it on focus...
57   - delay: 500,
58   - solo: false,
59   - ready: true
60   - },
61   - hide: 'mouseleave',
62   - style: 'qtip-rounded'
63   - });
64   -});
65   -
66   -
67   -//This is for the screens admin form - and probably belongs somewhere else
68   -jQuery(function($) {
69   - // when the field changes...
70   - $("#screen_owner_type").change(function() {
71   - // make a POST call and replace the content
72   - $.post("/update_owners", {owner: $('select#screen_owner_type :selected').val()}, function(data) {
73   - $("#owner_div").html(data);
74   - });
75   - });
76   -});
77   -
78   -
79   -function initFeedFilters() {
80   - $('.feed_filter').each(function(i){
81   - $(this).listFilter();
82   - });
83   -}
84   -
85   -$(document).ready(initFeedFilters);
56 app/assets/javascripts/basic_interactions.js
... ... @@ -0,0 +1,56 @@
  1 +function initBasicTooltips() {
  2 + // intitialization of qTip for basic tooltips:
  3 + // this means that tooltips can be used on any page for single-line messages
  4 + $(document).delegate(".tooltip-basic", "mouseover", function(event) {
  5 + $(this).qtip({
  6 + content: {
  7 + text: $(this).attr('data-tooltip-text')
  8 + },
  9 + position: {
  10 + at: 'bottom center', // Position the tooltip below the link
  11 + my: 'top center',
  12 + viewport: $(window) // Keep the tooltip on-screen at all times
  13 + },
  14 + show: {
  15 + event: 'mouseenter', // Show it on focus...
  16 + delay: 500,
  17 + solo: false,
  18 + ready: true
  19 + },
  20 + hide: 'mouseleave',
  21 + style: 'qtip-rounded'
  22 + });
  23 + });
  24 +}
  25 +
  26 +function initNoticeBannerDisplay() {
  27 + // flash-banner display animation:
  28 + if ( $("#flash-banner").html() !== "" ) {
  29 + $(function () {
  30 + var topmenuHeight = $("#top-menu").height();
  31 + $("#flash-banner").animate({
  32 + top: '+=' + topmenuHeight
  33 + }, 1000, function() {
  34 + // first animation is complete, so move it back up after 4 seconds:
  35 + $("#flash-banner").delay(4000).animate({
  36 + top: '0'
  37 + }, 1000, function() {});
  38 + });
  39 + });
  40 + }
  41 +}
  42 +
  43 +function initFeedFilters() {
  44 + $('.feed_filter').each(function(i){
  45 + $(this).listFilter();
  46 + });
  47 +}
  48 +
  49 +function initBasicInteractions() {
  50 + initNoticeBannerDisplay();
  51 + initBasicTooltips();
  52 + initFeedFilters();
  53 +}
  54 +
  55 +$(document).ready(initBasicInteractions);
  56 +$(document).on('page:change', initBasicInteractions);
8 app/assets/javascripts/datetime.js
@@ -31,9 +31,13 @@ function addDateTimeUi() {
31 31 }
32 32
33 33 function initDateTime() {
34   - if($('.datetime').length > 0) {
  34 + if($('.datefield').length > 0) {
35 35 addDateTimeUi();
36   - };
  36 + }
37 37 }
38 38
39 39 $(document).ready(initDateTime);
  40 +$(document).on('page:change', initDateTime);
  41 +$(document).on('page:change', function() {
  42 + $.datepicker.initialized = false;
  43 +});
1  app/assets/javascripts/duration.js
@@ -34,3 +34,4 @@ function initDuration(){
34 34 }
35 35
36 36 $(document).ready(initDuration);
  37 +$(document).on('page:change', initDuration);
1  app/assets/javascripts/login.js
@@ -35,5 +35,6 @@ function initLogin() {
35 35 }
36 36
37 37 $(document).ready(initLogin);
  38 +$(document).on('page:change', initLogin);
38 39
39 40
5 app/assets/javascripts/moderate.js
@@ -74,8 +74,9 @@ function addModerateUi(){
74 74 function initModerate() {
75 75 if($('.dd-moderate').length > 0){
76 76 addModerateUi();
77   - };
  77 + }
78 78 console.log($('.dd-moderate').length);
79   -};
  79 +}
80 80
81 81 $(document).ready(initModerate);
  82 +$(document).on('page:change', initModerate);
32 app/assets/javascripts/screens_views.js
... ... @@ -1,14 +1,3 @@
1   -$(document).ready(function() {
2   - // inset-selection gridlist: when a user clicks on an item in this
3   - // type of gridlist, auto-select the input that's inside of the item
4   - $("ul.list-grid.inset-selection li > a").click(function(e) {
5   - e.preventDefault();
6   - $(this).find(".inp input").prop("checked", true);
7   - });
8   -
9   - initTemplateSelector();
10   -});
11   -
12 1 function initTemplateSelector() {
13 2 $('.template-selector.dropdown-control').click(function(event) { event.preventDefault(); });
14 3 $('.template-selector.dropdown-control').each(function() {
@@ -38,3 +27,24 @@ function initTemplateSelector() {
38 27 });
39 28 });
40 29 }
  30 +
  31 +function initScreensViews() {
  32 + // inset-selection gridlist: when a user clicks on an item in this
  33 + // type of gridlist, auto-select the input that's inside of the item
  34 + $("ul.list-grid.inset-selection li > a").click(function(e) {
  35 + e.preventDefault();
  36 + $(this).find(".inp input").prop("checked", true);
  37 + });
  38 +
  39 + $("#screen_owner_type").change(function() {
  40 + // make a POST call and replace the content
  41 + $.post("/update_owners", {owner: $('select#screen_owner_type :selected').val()}, function(data) {
  42 + $("#owner_div").html(data);
  43 + });
  44 + });
  45 +
  46 + initTemplateSelector();
  47 +}
  48 +
  49 +$(document).ready(initScreensViews);
  50 +$(document).on('page:change', initScreensViews);
1  app/assets/javascripts/subscriptions.js
@@ -131,3 +131,4 @@ function initSubscriptions() {
131 131
132 132
133 133 $(document).ready(initSubscriptions);
  134 +$(document).on('page:change', initSubscriptions);
10 app/assets/stylesheets/application/components/tiles.scss.erb
@@ -60,16 +60,6 @@ a:hover > .tile {
60 60
61 61 .default-padding { padding: 6px; }
62 62
63   - h1,h2,h3,h4,h5,h6,p {
64   - padding: 0;
65   - margin: 0;
66   - line-height: 24px;
67   -
68   - &:hover {
69   - color: $white;
70   - }
71   - }
72   -
73 63 p {
74 64 color: $white;
75 65 line-height: 16px;
2  app/views/submissions/_submission_tile.html.erb
@@ -5,7 +5,7 @@
5 5 </div>
6 6 <div class="brand">
7 7 <% if not submission.content.children.empty? %>
8   - <div class="count">x 2</div>
  8 + <div class="count">x <%= submission.content.children.size %></div>
9 9 <% end %>
10 10 </div>
11 11 </div>
2  db/schema.rb
@@ -112,7 +112,7 @@
112 112 t.string "file_name"
113 113 t.string "file_type"
114 114 t.integer "file_size"
115   - t.binary "file_data", :limit => 10485760
  115 + t.binary "file_data", :limit => 16777215
116 116 t.datetime "created_at", :null => false
117 117 t.datetime "updated_at", :null => false
118 118 end

0 comments on commit cdc1075

Please sign in to comment.
Something went wrong with that request. Please try again.