Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ end

# Jquery stuff
gem 'better_datetimepicker', '~> 0.0.9', git: 'https://github.com/engaging-computing/better-datetimepicker'
gem 'better_colorpicker', '~> 0.1.2', git: 'https://github.com/engaging-computing/better-colorpicker'
gem 'jquery-minicolors-rails', '>= 2.2.6.1'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jqgrid-jquery-rails', '~> 4.6.001'
Expand Down
28 changes: 10 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
GIT
remote: https://github.com/jetthoughts/yaml_db.git
revision: 5f73cbd14adee939adf08574ec3bf6e05ee55889
specs:
yaml_db (0.2.3)

GIT
remote: https://github.com/ambethia/recaptcha
revision: 76c2f58ee906ed591662d552c6be383024af11d6
Expand All @@ -27,16 +21,6 @@ GIT
beaker (1.3.0)
rltk

GIT
remote: https://github.com/engaging-computing/better-colorpicker
revision: abb1a3ebb6e20bea6a3dfd5ed2b5bab09a83c552
specs:
better_colorpicker (0.1.2)
coffee-rails
coffee-rails-source-maps
rails (~> 4)
sass

GIT
remote: https://github.com/engaging-computing/better-datetimepicker
revision: a159fb6f3e0ad24712658f249d8dad22c514fc25
Expand All @@ -47,6 +31,12 @@ GIT
rails (~> 4)
sass

GIT
remote: https://github.com/jetthoughts/yaml_db
revision: 5f73cbd14adee939adf08574ec3bf6e05ee55889
specs:
yaml_db (0.2.3)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -188,6 +178,9 @@ GEM
jquery-ui-rails (>= 5.0.0)
railties (>= 3.1)
jquery-drag-rails (2.2.0)
jquery-minicolors-rails (2.2.6.1)
jquery-rails
rails (>= 3.2.8)
jquery-rails (3.1.3)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
Expand Down Expand Up @@ -319,7 +312,6 @@ GEM
multi_json (~> 1.0)
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slop (3.6.0)
spreadsheet (1.0.0)
ruby-ole (>= 1.0)
sprockets (2.12.5)
Expand Down Expand Up @@ -367,7 +359,6 @@ DEPENDENCIES
auto_html
bcrypt-ruby
beaker (~> 1.3.0)!
better_colorpicker (~> 0.1.2)!
better_datetimepicker (~> 0.0.9)!
bootstrap-sass
bootstrap-switch-rails
Expand All @@ -391,6 +382,7 @@ DEPENDENCIES
httparty
jqgrid-jquery-rails (~> 4.6.001)
jquery-drag-rails
jquery-minicolors-rails (>= 2.2.6.1)
jquery-rails
jquery-ui-rails
launchy
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
//= require validator
//= require jquery.caret.js
//= require jquery.form.js
//= require jquery.minicolors.js
//= require jquery.qrcode.min.js
//= require jquery-ui/sortable
//= require jquery.ui.touch-punch
Expand All @@ -50,7 +51,6 @@
//= require markerclustererplus
//= require numeric.min
//= require oms
//= require better_colorpicker
//= require better_datetimepicker
//= require visualizations/highvis/index
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<input type="checkbox" id="ckbx-{{id}}" class="mdl-checkbox__input" name="{{name}}" value="{{value}}"/>
<span class="mdl-checkbox__label">{{label}}</span>
</label>
{{#if picker}}
<a href="#" class="color-picker"
data-color="{{picker.color}}" data-color-id="{{value}}">
<img class="cpickr-icon" src="{{picker.icon}}">
</a>
{{/if}}
</div>
{{#if picker}}
<a href="#" class="color-picker"
data-color="{{picker.color}}" data-color-id="{{value}}">
<img class="cpickr-icon" src="{{picker.icon}}">
</a>
{{/if}}
</div>
72 changes: 45 additions & 27 deletions app/assets/javascripts/visualizations/highvis/baseVis.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -575,33 +575,6 @@ $ ->
globals.configs.groupOpen ?= false
initCtrlPanel('group-ctrls', 'groupOpen')

$('.color-picker').each (_, cpicker) =>
cid = $(cpicker).data('color-id')
a = $(cpicker).colorpicker
outputType: 'hex'
onOpen: () ->
$("#label-color-#{cid}").parent().parent().css('background-color', '#EEE')
globals.getColor(cid)
onClose: () ->
$("#label-color-#{cid}").parent().parent().css('background-color', '#FFF')
onSubmit: (color) =>
globals.setColor(cid, color)
$("#label-color-#{cid}").css 'color', color
@delayedUpdate()
setTimeout (() => @start()), 1
hPosition: (w, h) =>
button = $(cpicker).children('img')
buttonX = button.offset().left
buttonW = button.width()
buttonX - w + buttonW
vPosition: (w, h) =>
button = $(cpicker).children('img')
buttonY = button.offset().top
buttonH = button.height()
buttonY + buttonH

$(cpicker).click ->
a.open()

$('#group-by').val(globals.configs.groupById)
$('#group-by').change (e) =>
Expand Down Expand Up @@ -629,6 +602,50 @@ $ ->
$('#ckbx-lbl-ckall-grouping')[0].MaterialCheckbox.uncheck()
$('#ckbx-ckall-grouping').prop('indeterminate', indeterminate)

# minicolors settings
$('input[name="color-picker"]').each (_, cpicker) =>
cid = $(cpicker).data('color-id')
console.log(cid)
timeline = this
$(cpicker).minicolors (
changeDelay: 200
format: 'hex'
change: (value, opacity) ->
globals.setColor(cid, color)
console.log($("#label-color-#{cid}"))
$("#label-color-#{cid}").css 'color', value
timeline.delayedUpdate()
setTimeout (() => timeline.start), 1
)

# 4 da referenz
# $('.color-picker').each (_, cpicker) =>
# cid = $(cpicker).data('color-id')
# a = $(cpicker).colorpicker
# outputType: 'hex'
# onOpen: () ->
# $("#label-color-#{cid}").parent().parent().css('background-color', '#EEE')
# globals.getColor(cid)
# onClose: () ->
# $("#label-color-#{cid}").parent().parent().css('background-color', '#FFF')
# onSubmit: (color) =>
# globals.setColor(cid, color)
# $("#label-color-#{cid}").css 'color', color
# @delayedUpdate()
# setTimeout (() => @start()), 1
# hPosition: (w, h) =>
# button = $(cpicker).children('img')
# buttonX = button.offset().left
# buttonW = button.width()
# buttonX - w + buttonW
# vPosition: (w, h) =>
# button = $(cpicker).children('img')
# buttonY = button.offset().top
# buttonH = button.height()
# buttonY + buttonH
#
# $(cpicker).click ->
# a.open()
# Update the check all box
updateCheckAll()

Expand Down Expand Up @@ -666,6 +683,7 @@ $ ->
updateCheckAll()
@delayedUpdate()


###
Draws vis saving controls
###
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require better_colorpicker
*= require better_datetimepicker
*= require font-awesome
*= require summernote
*= require jquery-ui
*= require jqgrid-jquery-rails
*= require jquery.minicolors
*= require slickgrid/slick.grid.css
*= require_tree .
*= require_self
Expand Down
15 changes: 2 additions & 13 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,13 @@ def views
def to_hash(recurse = true)
h = {
id: id,
featuredMediaId: featured_media_id,
name: name,
url: UrlGenerator.new.project_url(self),
path: UrlGenerator.new.project_path(self),
hidden: hidden,
featured: featured,
likeCount: likes.length,
content: content,
timeAgoInWords: time_ago_in_words(created_at),
createdAt: created_at.strftime('%B %d, %Y'),
ownerName: owner.nil? ? nil : owner.name,
ownerUrl: owner.nil? ? nil : UrlGenerator.new.user_url(owner),
dataSetCount: data_sets.length,
dataSetIDs: data_sets.to_a.map(&:id),
fieldCount: fields.length,
fields: fields.map { |o| o.to_hash false },
formulaFieldCount: formula_fields.length,
formulaFields: formula_fields.map { |o| o.to_hash false }
datapointCount: data_sets.count,

}

unless featured_media_id.nil?
Expand Down
3 changes: 0 additions & 3 deletions test/integration/api_v1_data_sets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ class ApiV1DataSetsTest < ApiV1Test

get "/api/v1/data_sets/#{dset_id}?recur=true"
assert_response :success
new_data = parse(response)['data']

assert new_data != old_data, 'Data didnt get updated'
assert new_data[0]['20'] == '5', 'First point should have been updated to 5'
end

test 'failed edit data set' do
Expand Down