From db363484901a9521949cdd394c0701bb51153e2b Mon Sep 17 00:00:00 2001 From: Ofer Lehr Date: Sat, 6 Dec 2014 22:43:12 +0200 Subject: new info box (now card) styling - Partial added a class to the info card to style different types in css. also rearranged colors in helpers.js (alon: changed implementation and broke the edit, will fix in the morning) --- src/view/helpers.js | 23 +++++++++++++---------- src/view/node_info.js | 39 ++++++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 27 deletions(-) (limited to 'src/view') diff --git a/src/view/helpers.js b/src/view/helpers.js index 41d99891..ad11763a 100644 --- a/src/view/helpers.js +++ b/src/view/helpers.js @@ -5,35 +5,38 @@ function customColor(type) { var color; switch (type) { case "person": - color = '#FCB924'; + color = '#FCB924'; //blue break; case "club": - color = '#009DDC'; + color = '#ee3654'; //magenta break; case "skill": - color = '#62BB47'; + color = '#fad900'; //yellow break; case "third-internship-proposal": - color = '#202020'; + color = '#33c2e0'; //cyan break; case "internship": - color = '#933E99'; + color = '#ff8b11'; //orange break; case "interest": - color = '#933E99'; + color = '#8b3ab0'; //purple + break; + case "project": + color = "#40C200"; //green break; case "empty": - color = "#080808"; + color = "#919095"; //mid-grey break; case "chainlink": - color = "#fff"; + color = "#363636"; //dark-grey break; case "bubble": - color = "rgba(0,0,0,0.2)"; + color = "rgba(255,255,255,0.2)"; // white, 0.2 opaque break; default: console.log('bug: unknown type ' + type); - color = '#080808'; + color = '#d4d4d9'; //mid-light grey break; } return color; diff --git a/src/view/node_info.js b/src/view/node_info.js index a3b8f7d4..494b674b 100644 --- a/src/view/node_info.js +++ b/src/view/node_info.js @@ -2,34 +2,39 @@ define(['jquery', 'jquery-ui', 'view/helpers', 'view/internal'], function($, _unused_jquery_ui, view_helpers, internal) { function show(d) { - var editURL = '', - name_field = 'Name: ' + '', - html; - + var info = $('.info'), // #TODO - move to tab + f = false, + t = true, + visible = { + "third-internship-proposal": [t, t, t, f, f], + "chainlink": [f, f, f, f, f], + "skill": [f, f, f, f, t], + "interest": [f, f, f, f, t], + "_defaults": [f, f, f, f, t], + }, + fields = ["status", "startdate", "enddate", "desc", "url"], + flags = visible.hasOwnProperty(d.type) ? visible[d.type] : visible._defaults, + i; + internal.edit_tab.show('node'); - if (d.type === "third-internship-proposal") { - html = '




'; - } else if(d.type=== "chainlink"){ - html = '
'; - }else{ - if (d.type !== 'skill' && d.type !== 'interest') { - editURL = '' - } - html = '

' + editURL + '
'; + for (i = 0 ; i < flags.length; ++i) { + if (flags[i]) { + info.find(fields[i]).show(); + } else { + info.find(fields[i]).hide(); + } } - $('.info').html(name_field + html); - $('.info').css("border-color", view_helpers.customColor(d.type)); + $('.info').attr('class', 'info'); + $('.info').addClass('type-' + d.type); // Add a class to distinguish types for css $('.info').find('#editformname').val(d.name); - $("#editenddate").datepicker({ inline: true, showOtherMonths: true, dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], }); - $("#editstartdate").datepicker({ inline: true, showOtherMonths: true, -- cgit v1.3.1