Skip to content

Commit

Permalink
Merge branch 'release-2.1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Lewis committed Jun 22, 2017
2 parents b46aba3 + 05cd469 commit 09c3b51
Show file tree
Hide file tree
Showing 74 changed files with 1,481 additions and 294 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ ruby '2.3.0'

gem 'acl9', git: 'https://github.com/be9/acl9.git', branch: 'finalist-update-rails'
gem 'actionpack-action_caching', '~> 1.2'
gem 'active_interaction', '~> 3.4'
gem 'acts-as-taggable-on', '~> 4.0'
gem 'acts_as_api', '~> 0.4'
gem 'bootstrap-sass', '~> 3.3'
gem 'breadcrumbs', '~> 0.1'
gem 'devise', '~> 4.2'
gem 'exception_notification', '~> 2.6'
gem 'feed-abstract', '0.0.13'
gem 'feed-abstract', '0.0.15'
gem 'font-awesome-rails', '~> 4.7'
gem 'formtastic', '~> 3.1'
gem 'formtastic-bootstrap', git: 'https://github.com/mjbellantoni/formtastic-bootstrap.git'
Expand Down
13 changes: 8 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ GEM
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
active_interaction (3.4.0)
activemodel (>= 4, < 6)
activejob (5.0.1)
activesupport (= 5.0.1)
globalid (>= 0.3.6)
Expand Down Expand Up @@ -140,7 +142,7 @@ GEM
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
feed-abstract (0.0.13)
feed-abstract (0.0.15)
ffi (1.9.17)
font-awesome-rails (4.7.0.1)
railties (>= 3.2, < 5.1)
Expand Down Expand Up @@ -197,9 +199,9 @@ GEM
minitest (5.10.1)
mustermann (1.0.0.beta2)
nio4r (1.2.1)
nokogiri (1.7.0.1)
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
nokogumbo (1.4.10)
nokogumbo (1.4.11)
nokogiri
non-stupid-digest-assets (1.0.9)
sprockets (>= 2.0)
Expand Down Expand Up @@ -404,6 +406,7 @@ PLATFORMS
DEPENDENCIES
acl9!
actionpack-action_caching (~> 1.2)
active_interaction (~> 3.4)
acts-as-taggable-on (~> 4.0)
acts_as_api (~> 0.4)
awesome_print (~> 1.7)
Expand All @@ -415,7 +418,7 @@ DEPENDENCIES
drg (~> 1.5)
exception_notification (~> 2.6)
factory_girl_rails (~> 4.8)
feed-abstract (= 0.0.13)
feed-abstract (= 0.0.15)
font-awesome-rails (~> 4.7)
formtastic (~> 3.1)
formtastic-bootstrap!
Expand Down Expand Up @@ -470,4 +473,4 @@ RUBY VERSION
ruby 2.3.0p0

BUNDLED WITH
1.14.5
1.14.6
27 changes: 3 additions & 24 deletions app/assets/javascripts/application.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -815,29 +815,6 @@ $(document).ready(function(){
}
});

$('.hub_feed_more_control,.republished_feed_more_control').live({
click: function(e){
e.preventDefault();
if($(this).hasClass('more_details_included')){
$(this).closest('li').find('.metadata').remove();
$(this).removeClass('more_details_included');
$(this).find('.fa').removeClass('fa-caret-down');
$(this).find('.fa').addClass('fa-caret-right');
return;
}
var elem = this;
$.ajax({
url: $(this).attr('href'),
success: function(html){
$(elem).addClass('more_details_included');
$(elem).closest('li').find('.media-body').append(html);
$(elem).find('.fa').removeClass('fa-caret-right');
$(elem).find('.fa').addClass('fa-caret-down');
}
});
}
});

if($('.ui-widget-content').length > 0){
$('#hub_search_form,#hub_tag_search_form').live({
submit: function(e){
Expand Down Expand Up @@ -872,6 +849,7 @@ $(document).ready(function(){
var item_source_id = $('body').data('item_source_id_for_republishing');
var item_source_type = $('body').data('item_source_type_for_republishing');
var item_effect = $('body').data('item_effect_for_republishing');
var user_id = $('input[name="user_ids[]"]').val();
var search_query = $('#q').val();
var hub_id = $('body').data('hub_id');
var args = {
Expand All @@ -881,7 +859,8 @@ $(document).ready(function(){
republished_feed_id: republished_feed_id,
item_source_type: item_source_type,
item_source_id: item_source_id,
effect: item_effect
effect: item_effect,
created_by_only_id: (typeof user_id === 'undefined' ? false : user_id)
}
};

Expand Down
68 changes: 68 additions & 0 deletions app/assets/javascripts/autocomplete_user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* global $ */
$.extend({
observeSearchSelectControl () {
$('.search_select_control').live({
click (e) {
e.preventDefault();

var container = $(this).closest('ul');

$(this).closest('li.search_select').remove();

if (container.children('li').length === 0) {
$('input#add_roles').prop('disabled', true);
}
}
});
},

observeAutocomplete (url, rootId, paramName, containerId, elementClass, singleValue) {
function split (val) {
return val.split(/,\s*/);
}

function extractLast (term) {
return split(term).pop();
}

$(rootId)
.live('keydown', function (event) {
if (event.keyCode === $.ui.keyCode.TAB && $(this).data('autocomplete').menu.active) {
event.preventDefault();
}
})
.live('focus', function () {
$(this)
.autocomplete({
source (request, response) {
$.getJSON(url, {
term: extractLast(request.term)
}, response);
},
search () {
const term = extractLast(this.value);
if (term.length < 2) {
return false;
}
},
focus () {
return false;
},
select (event, ui) {
if (typeof singleValue != 'undefined' && singleValue === true) {
$(containerId).empty();
}

const node = $('<li>').attr('class', elementClass);
$(node).html($('<input name="' + paramName + '[]" type="hidden" />').val(ui.item.value))
$(node).append(ui.item.label);
$(node).append('<span class="search_select_control"> X </span>');
$(containerId).show().append(node);
$('input#add_roles').prop('disabled', false);
this.value = '';
return false;
}
});
});
}
});
32 changes: 32 additions & 0 deletions app/assets/javascripts/hubs/bookmark_collections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* globals $ */
$('.hub_feed_more_control, .republished_feed_more_control')
.live({ click: toggleListItemMetadata })

function toggleListItemMetadata (e) {
e.preventDefault()

var element = $(this)

if (element.hasClass('more_details_included')) {
hideListItemMetadata(element)
} else {
showListItemMetadata(element)
}
}

function hideListItemMetadata (element) {
element.removeClass('more_details_included')
element.closest('li').find('.metadata').empty()
element.find('.fa').removeClass('fa-caret-down').addClass('fa-caret-right')
}

function showListItemMetadata (element) {
$.ajax({
url: element.attr('href'),
success: function (html) {
element.addClass('more_details_included')
element.closest('li').find('.metadata').replaceWith(html)
element.find('.fa').removeClass('fa-caret-right').addClass('fa-caret-down')
}
})
}
62 changes: 1 addition & 61 deletions app/assets/javascripts/hubs/community.js
Original file line number Diff line number Diff line change
@@ -1,61 +1 @@
/* global $ */
$.extend({
observeSearchSelectControl () {
$('.search_select_control').live({
click (e) {
e.preventDefault()

var container = $(this).closest('ul')

$(this).closest('li.search_select').remove()

if (container.children('li').length === 0) {
$('input#add_roles').prop('disabled', true)
}
}
})
},

observeAutocomplete (url, rootId, paramName, containerId, elementClass) {
function split (val) {
return val.split(/,\s*/)
}

function extractLast (term) {
return split(term).pop()
}

$(rootId)
.bind('keydown', function (event) {
if (event.keyCode === $.ui.keyCode.TAB && $(this).data('autocomplete').menu.active) {
event.preventDefault()
}
})
.autocomplete({
source (request, response) {
$.getJSON(url, {
term: extractLast(request.term)
}, response)
},
search () {
const term = extractLast(this.value)
if (term.length < 2) {
return false
}
},
focus () {
return false
},
select (event, ui) {
const node = $('<li>').attr('class', elementClass)
$(node).html($(`<input name="${paramName}[]" type="hidden" />`).val(ui.item.value))
$(node).append(ui.item.label)
$(node).append('<span class="search_select_control"> X </span>')
$(containerId).show().append(node)
$('input#add_roles').prop('disabled', false)
this.value = ''
return false
}
})
}
})
//= require autocomplete_user
1 change: 1 addition & 0 deletions app/assets/javascripts/hubs/custom_republished_feeds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= require autocomplete_user
6 changes: 6 additions & 0 deletions app/assets/stylesheets/hubs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ form.hub {
&:hover {
color: $gray;
}

&.fa-plus {
margin-top: 2px;
color: #8dc63f;
vertical-align: middle;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/bookmarklets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def add_item
@feed_item.id,
@hub.id,
current_user.id,
@feed_item.id
@feed_item.id,
tags_added: new_tags
)
end

Expand Down
31 changes: 31 additions & 0 deletions app/controllers/export_import_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'tempfile'

class ExportImportController < ApplicationController
before_action :authenticate_user!

def index
breadcrumbs.add 'Export/import', export_import_path
end

def download
data = Tagteam::ExportImport.get_all_user_data current_user

send_data data, filename: format('tagteam_export_%s.json', Time.now)
end

def import
if params[:file].nil?
flash[:error] = 'File is missing, please try again.'
else
temp_file = Tempfile.new('tagteam_import')
temp_file.write(File.read(params[:file].tempfile))
ObjectSpace.undefine_finalizer(temp_file)

Sidekiq::Client.enqueue(ImportUserData, temp_file.path, current_user.email)

flash[:notice] = 'Import is in progress. You will get an email notification when the import is done.'
end

redirect_to request.referer
end
end
Loading

0 comments on commit 09c3b51

Please sign in to comment.