From 02afd8a32edb13ea7fc2266ac80092ea15c0930c Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Wed, 9 Oct 2013 15:52:53 +0800 Subject: * treat 'apps/utils' as regular django app; which used to store general tools for used in other apps * moved 'templatetags' from 'apps/indicator' to 'apps/utils' * '.gitignore' to ignore 'fixtures_bak' * moved js plugins from 'apps/indicator/static/plugins' to 'staticfiles/plugins' apps/recommend: * updated 'recommend.models'; o commented 'recommend.models.ResearchCombination' (not used) * implemented views 'add_edit_blog_info' and 'ajax_add_edit_configs'; * added pages 'templates/recommend/add_edit_blog_info.html', 'add_edit_blog_info_error.html'; o related css and javascripts files * added 'tools.py'; * added 'utils/tools.py' for placing generic functions; * deleted 'initial_data.json' (mv 'fixtures' to 'fixtures_bak'); * small fixes to 'indicator.models', 'sciblog.models' and 'sfaccount.views' * fixed automatically show 'proper_nouns' annotation in blog: recovered the line 'import signals' in 'sciblog.models' * added 'is_ok()' method for 'recommend.models.ResearchConfig'; --- .../recommend/static/css/add_edit_blog_info.css | 107 +++++++ .../apps/recommend/static/css/recommend_index.css | 21 ++ .../static/javascripts/add_edit_blog_info.js | 330 +++++++++++++++++++++ 3 files changed, 458 insertions(+) create mode 100644 97suifangqa/apps/recommend/static/css/add_edit_blog_info.css create mode 100644 97suifangqa/apps/recommend/static/css/recommend_index.css create mode 100644 97suifangqa/apps/recommend/static/javascripts/add_edit_blog_info.js (limited to '97suifangqa/apps/recommend/static') diff --git a/97suifangqa/apps/recommend/static/css/add_edit_blog_info.css b/97suifangqa/apps/recommend/static/css/add_edit_blog_info.css new file mode 100644 index 0000000..6d2137e --- /dev/null +++ b/97suifangqa/apps/recommend/static/css/add_edit_blog_info.css @@ -0,0 +1,107 @@ +/* + * css for 'add_edit_blog_info' page + * + * 2013/10/07 + */ + +section { + margin: 0.8em; +} + +h4 { + margin: 0.5em; +} + +p { + margin: 0.3em; +} + +section.categories { + border: 1px solid #4A4A4A; + border-radius: 2px; + padding: 0.8em; +} + +section.combinations { + border: 1px solid #4A4A4A; + border-radius: 2px; + padding: 0.8em; +} + +section.configs { + border: 1px solid #99CC33; + border-radius: 2px; + padding: 0.8em; +} + +input[type="button"], input[type="submit"] { + background-color: #99CC33; + border: 1px solid #F3F2F0; + border-radius: 3px; + box-shadow: 0 0 2px #FFFFFF; + color: #FFFFFF; + cursor: pointer; + height: 2.1em; + padding-left: 0.8em; + padding-right: 0.8em; + vertical-align: middle; +} + +input.selected[type="button"] { + background-color: #99CC33; + color: #FFFFFF; + border-color: #F3F2F0; +} + +input.unselected[type="button"] { + background-color: #FFFFFF; + color: #7E7E7E; + border-color: #4A4A4A; +} + +input[type="text"] { + width: 50px; + border-radius: 1px; + border: 1px solid #9C9C9C; +} +input.weight.valid { + border: 2px solid green; +} +input.weight.invalid { + border: 2px solid red; +} + +table { + width: 100%; +} +table th.name { + width: 70%; +} +table th.response { + width: 20%; +} +table th.weight { + width: 10%; +} +th, td { + /* border: 1px solid black; */ + padding: 0.2em; +} +table tr.odd { + background-color: #E0F0C2; +} +table tr.invalid { + background-color: #FFCCCC; +} + +select.treat_response { + border: 1px solid #9C9C9C; + background-color: #FFFFFF; + color: #000000; +} + +span.error { + background-color: #FFB3B3; + padding: 2px; +} + diff --git a/97suifangqa/apps/recommend/static/css/recommend_index.css b/97suifangqa/apps/recommend/static/css/recommend_index.css new file mode 100644 index 0000000..0039a2c --- /dev/null +++ b/97suifangqa/apps/recommend/static/css/recommend_index.css @@ -0,0 +1,21 @@ +/* + * css for 'recommend_index' page + * + * 2013/10/07 + */ + + +ul li { + padding: 4px +} + +span.has_info, .has_info a { + background-color: #B8DB70; + padding: 2px; +} + +span.error { + background-color: #FFB3B3; + padding: 2px; +} + diff --git a/97suifangqa/apps/recommend/static/javascripts/add_edit_blog_info.js b/97suifangqa/apps/recommend/static/javascripts/add_edit_blog_info.js new file mode 100644 index 0000000..1d994e5 --- /dev/null +++ b/97suifangqa/apps/recommend/static/javascripts/add_edit_blog_info.js @@ -0,0 +1,330 @@ +// +// js for 'add_edit_blog_info' page +// +// 2013/10/08 +// + +// a list contains all the configs data objects +var research_configs_list = new Array(); + +$(document).ready(function() { + // make a configs list from 'research_configs {{{ + var obj_keys = Object.keys(research_configs); + for (var i=0; i   '; + }; + $("#cate_btns").html(cate_btns_html); + // button actions + $('#cate_btns input[type="button"]').on("click", document, function() { + // unselect all buttons + //console.log(this); + $('#cate_btns input[type="button"]').removeClass("selected"); + $('#cate_btns input[type="button"]').addClass("unselected"); + $(this).removeClass("unselected"); + $(this).addClass("selected"); + // unselect buttons of combinations + $('#comb_divs input[type="button"]').removeClass("selected"); + $('#comb_divs input[type="button"]').addClass("unselected"); + // hide configs div's + $('#conf_divs .conf_comb').hide(); + // display category of combinations + var cate_id = $(this).attr('id').replace('btn_cate_', ''); + $('#comb_divs .comb').hide(); + $('#div_comb_'+cate_id).show(); + }); + // }}} + + // indicator combinations div's and buttons {{{ + var comb_divs_html = ''; + for (var i=1; i<=rind_num; i++) { + var id = 'div_comb_'+i; + comb_divs_html += '\n'; + }; + $("#comb_divs").html(comb_divs_html); + // button actions + $('#comb_divs input[type="button"]').on("click", document, function() { + // unselect all buttons + $('#comb_divs input[type="button"]').removeClass("selected"); + $('#comb_divs input[type="button"]').addClass("unselected"); + $(this).removeClass("unselected"); + $(this).addClass("selected"); + // display configs of the combination + var comb_id = $(this).attr('id'); + $('#conf_divs .conf_comb').hide(); + $('#div_conf_'+comb_id).show(); + }); + // }}} + + // config div's & info input {{{ + var conf_divs_html = ''; + for (var i=0; i