Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
View
1  Gemfile
@@ -30,6 +30,7 @@ group :assets do
end
gem 'jquery-rails'
+gem 'turbolinks'
gem 'jquery-timepicker-rails'
# In production we prefer MySQL over sqlite3. If you are only
View
2  Gemfile-reporting
@@ -2,4 +2,4 @@
gem 'airbrake'
#Girl Friday makes Airbrake async.
-gem 'girl_friday'
+gem 'girl_friday'
View
19 Gemfile.lock
@@ -55,7 +55,7 @@ GEM
daemons (1.1.9)
delayed_job (3.0.5)
activesupport (~> 3.0)
- delayed_job_active_record (0.4.0)
+ delayed_job_active_record (0.4.1)
activerecord (>= 2.1.0, < 4)
delayed_job (~> 3.0)
devise (2.2.3)
@@ -77,21 +77,21 @@ GEM
thor (>= 0.14, < 2.0)
jquery-timepicker-rails (0.2.0)
railties (>= 3.1.0)
- json (1.7.6)
+ json (1.7.7)
libv8 (3.11.8.13)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.19)
- multi_json (1.5.0)
+ mime-types (1.21)
+ multi_json (1.6.1)
mysql2 (0.3.11)
orm_adapter (0.4.0)
polyglot (0.3.3)
- rack (1.4.4)
+ rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
- rack-ssl (1.3.2)
+ rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
@@ -113,7 +113,7 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
- rdoc (3.12)
+ rdoc (3.12.1)
json (~> 1.4)
ref (1.0.2)
rmagick (2.13.2)
@@ -135,7 +135,7 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.7)
- strong_parameters (0.1.6)
+ strong_parameters (0.2.0)
actionpack (~> 3.0)
activemodel (~> 3.0)
railties (~> 3.0)
@@ -148,6 +148,8 @@ GEM
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
+ turbolinks (1.0.0)
+ coffee-rails
tzinfo (0.3.35)
uglifier (1.3.0)
execjs (>= 0.3.0)
@@ -182,4 +184,5 @@ DEPENDENCIES
strong_parameters
sys-proctable
therubyracer
+ turbolinks
uglifier (>= 1.0.3)
View
68 app/assets/javascripts/application.js
@@ -12,74 +12,10 @@
//
//= require jquery
//= require jquery_ujs
+//= require turbolinks
+// require jquery.turbolinks
//= require jquery-ui
//= require html5_shiv/html5
//= require jquery.qtip.min
//= require jquery.timepicker.js
//= require_tree .
-
-// require turbolinks
-// require jquery.turbolinks
-
-$(document).ready(function () {
-
- // flash-banner display animation:
- if ( $("#flash-banner").html() !== "" ) {
- $(function () {
- var topmenuHeight = $("#top-menu").height();
- $("#flash-banner").animate({
- top: '+=' + topmenuHeight
- }, 1000, function() {
- // first animation is complete, so move it back up after 4 seconds:
- $("#flash-banner").delay(4000).animate({
- top: '0'
- }, 1000, function() {});
- });
- });
- }
-
-});
-
-// intitialization of qTip for basic tooltips:
-// this means that tooltips can be used on any page for single-line messages
-$(document).delegate(".tooltip-basic", "mouseover", function(event) {
- $(this).qtip({
- content: {
- text: $(this).attr('data-tooltip-text')
- },
- position: {
- at: 'bottom center', // Position the tooltip below the link
- my: 'top center',
- viewport: $(window) // Keep the tooltip on-screen at all times
- },
- show: {
- event: 'mouseenter', // Show it on focus...
- delay: 500,
- solo: false,
- ready: true
- },
- hide: 'mouseleave',
- style: 'qtip-rounded'
- });
-});
-
-
-//This is for the screens admin form - and probably belongs somewhere else
-jQuery(function($) {
- // when the field changes...
- $("#screen_owner_type").change(function() {
- // make a POST call and replace the content
- $.post("/update_owners", {owner: $('select#screen_owner_type :selected').val()}, function(data) {
- $("#owner_div").html(data);
- });
- });
-});
-
-
-function initFeedFilters() {
- $('.feed_filter').each(function(i){
- $(this).listFilter();
- });
-}
-
-$(document).ready(initFeedFilters);
View
56 app/assets/javascripts/basic_interactions.js
@@ -0,0 +1,56 @@
+function initBasicTooltips() {
+ // intitialization of qTip for basic tooltips:
+ // this means that tooltips can be used on any page for single-line messages
+ $(document).delegate(".tooltip-basic", "mouseover", function(event) {
+ $(this).qtip({
+ content: {
+ text: $(this).attr('data-tooltip-text')
+ },
+ position: {
+ at: 'bottom center', // Position the tooltip below the link
+ my: 'top center',
+ viewport: $(window) // Keep the tooltip on-screen at all times
+ },
+ show: {
+ event: 'mouseenter', // Show it on focus...
+ delay: 500,
+ solo: false,
+ ready: true
+ },
+ hide: 'mouseleave',
+ style: 'qtip-rounded'
+ });
+ });
+}
+
+function initNoticeBannerDisplay() {
+ // flash-banner display animation:
+ if ( $("#flash-banner").html() !== "" ) {
+ $(function () {
+ var topmenuHeight = $("#top-menu").height();
+ $("#flash-banner").animate({
+ top: '+=' + topmenuHeight
+ }, 1000, function() {
+ // first animation is complete, so move it back up after 4 seconds:
+ $("#flash-banner").delay(4000).animate({
+ top: '0'
+ }, 1000, function() {});
+ });
+ });
+ }
+}
+
+function initFeedFilters() {
+ $('.feed_filter').each(function(i){
+ $(this).listFilter();
+ });
+}
+
+function initBasicInteractions() {
+ initNoticeBannerDisplay();
+ initBasicTooltips();
+ initFeedFilters();
+}
+
+$(document).ready(initBasicInteractions);
+$(document).on('page:change', initBasicInteractions);
View
8 app/assets/javascripts/datetime.js
@@ -31,9 +31,13 @@ function addDateTimeUi() {
}
function initDateTime() {
- if($('.datetime').length > 0) {
+ if($('.datefield').length > 0) {
addDateTimeUi();
- };
+ }
}
$(document).ready(initDateTime);
+$(document).on('page:change', initDateTime);
+$(document).on('page:change', function() {
+ $.datepicker.initialized = false;
+});
View
1  app/assets/javascripts/duration.js
@@ -34,3 +34,4 @@ function initDuration(){
}
$(document).ready(initDuration);
+$(document).on('page:change', initDuration);
View
1  app/assets/javascripts/login.js
@@ -35,5 +35,6 @@ function initLogin() {
}
$(document).ready(initLogin);
+$(document).on('page:change', initLogin);
View
5 app/assets/javascripts/moderate.js
@@ -74,8 +74,9 @@ function addModerateUi(){
function initModerate() {
if($('.dd-moderate').length > 0){
addModerateUi();
- };
+ }
console.log($('.dd-moderate').length);
-};
+}
$(document).ready(initModerate);
+$(document).on('page:change', initModerate);
View
32 app/assets/javascripts/screens_views.js
@@ -1,14 +1,3 @@
-$(document).ready(function() {
- // inset-selection gridlist: when a user clicks on an item in this
- // type of gridlist, auto-select the input that's inside of the item
- $("ul.list-grid.inset-selection li > a").click(function(e) {
- e.preventDefault();
- $(this).find(".inp input").prop("checked", true);
- });
-
- initTemplateSelector();
-});
-
function initTemplateSelector() {
$('.template-selector.dropdown-control').click(function(event) { event.preventDefault(); });
$('.template-selector.dropdown-control').each(function() {
@@ -38,3 +27,24 @@ function initTemplateSelector() {
});
});
}
+
+function initScreensViews() {
+ // inset-selection gridlist: when a user clicks on an item in this
+ // type of gridlist, auto-select the input that's inside of the item
+ $("ul.list-grid.inset-selection li > a").click(function(e) {
+ e.preventDefault();
+ $(this).find(".inp input").prop("checked", true);
+ });
+
+ $("#screen_owner_type").change(function() {
+ // make a POST call and replace the content
+ $.post("/update_owners", {owner: $('select#screen_owner_type :selected').val()}, function(data) {
+ $("#owner_div").html(data);
+ });
+ });
+
+ initTemplateSelector();
+}
+
+$(document).ready(initScreensViews);
+$(document).on('page:change', initScreensViews);
View
1  app/assets/javascripts/subscriptions.js
@@ -131,3 +131,4 @@ function initSubscriptions() {
$(document).ready(initSubscriptions);
+$(document).on('page:change', initSubscriptions);
View
10 app/assets/stylesheets/application/components/tiles.scss.erb
@@ -60,16 +60,6 @@ a:hover > .tile {
.default-padding { padding: 6px; }
- h1,h2,h3,h4,h5,h6,p {
- padding: 0;
- margin: 0;
- line-height: 24px;
-
- &:hover {
- color: $white;
- }
- }
-
p {
color: $white;
line-height: 16px;
View
2  app/views/submissions/_submission_tile.html.erb
@@ -5,7 +5,7 @@
</div>
<div class="brand">
<% if not submission.content.children.empty? %>
- <div class="count">x 2</div>
+ <div class="count">x <%= submission.content.children.size %></div>
<% end %>
</div>
</div>
View
2  db/schema.rb
@@ -112,7 +112,7 @@
t.string "file_name"
t.string "file_type"
t.integer "file_size"
- t.binary "file_data", :limit => 10485760
+ t.binary "file_data", :limit => 16777215
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
Please sign in to comment.
Something went wrong with that request. Please try again.