From f6381d48f23d3f42965ca37170bfe1c726de31da Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 19 Aug 2014 19:03:17 -0300 Subject: [PATCH] proposals_discussion: new layout for discussion view --- lib/proposals_discussion_plugin/proposals_list_helper.rb | 2 +- lib/proposals_discussion_plugin/topic.rb | 2 +- public/perfect-scrollbar.min.css | 5 +++++ public/perfect-scrollbar.min.js | 4 ++++ public/perfect-scrollbar.with-mousewheel.min.js | 4 ++++ public/proposals_list.js | 12 +++++++++--- public/style.css | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- views/content_viewer/_proposal_card.html.erb | 10 +++------- views/content_viewer/_proposals_list.html.erb | 6 +----- views/content_viewer/discussion.html.erb | 25 ++++++++++++++----------- views/content_viewer/topic.html.erb | 36 +++++++++++++++++++++++++++--------- 11 files changed, 119 insertions(+), 68 deletions(-) create mode 100644 public/perfect-scrollbar.min.css create mode 100644 public/perfect-scrollbar.min.js create mode 100644 public/perfect-scrollbar.with-mousewheel.min.js diff --git a/lib/proposals_discussion_plugin/proposals_list_helper.rb b/lib/proposals_discussion_plugin/proposals_list_helper.rb index 7a37027..2bb568e 100644 --- a/lib/proposals_discussion_plugin/proposals_list_helper.rb +++ b/lib/proposals_discussion_plugin/proposals_list_helper.rb @@ -1,7 +1,7 @@ module ProposalsDiscussionPlugin::ProposalsListHelper def more_proposals(text, holder, order, page=1) - link_to '', url_for({:controller => 'proposals_discussion_plugin_public', :action => 'load_proposals', :holder_id => holder.id, :profile => profile.identifier, :order => order, :page => page }) + link_to text, url_for({:controller => 'proposals_discussion_plugin_public', :action => 'load_proposals', :holder_id => holder.id, :profile => profile.identifier, :order => order, :page => page }) end end diff --git a/lib/proposals_discussion_plugin/topic.rb b/lib/proposals_discussion_plugin/topic.rb index eedb621..44d8064 100644 --- a/lib/proposals_discussion_plugin/topic.rb +++ b/lib/proposals_discussion_plugin/topic.rb @@ -24,7 +24,7 @@ class ProposalsDiscussionPlugin::Topic < Folder def to_html(options = {}) proc do - render :file => 'content_viewer/topic' + render :file => 'content_viewer/topic', :locals => {:topic => @page} end end diff --git a/public/perfect-scrollbar.min.css b/public/perfect-scrollbar.min.css new file mode 100644 index 0000000..44217d9 --- /dev/null +++ b/public/perfect-scrollbar.min.css @@ -0,0 +1,5 @@ +/*! perfect-scrollbar - v0.4.11 +* http://noraesae.github.com/perfect-scrollbar/ +* Copyright (c) 2014 Hyeonje Alex Jun; Licensed MIT */ + +.ps-container .ps-scrollbar-x-rail{position:absolute;bottom:3px;height:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-x-rail,.ps-container.hover .ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x-rail:hover,.ps-container .ps-scrollbar-x-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail{position:absolute;right:3px;width:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-y-rail,.ps-container.hover .ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y-rail:hover,.ps-container .ps-scrollbar-y-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x{position:absolute;bottom:0;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container.ie6 .ps-scrollbar-x{font-size:0}.ps-container .ps-scrollbar-x-rail:hover .ps-scrollbar-x,.ps-container .ps-scrollbar-x-rail.hover .ps-scrollbar-x{background-color:#999}.ps-container .ps-scrollbar-y{position:absolute;right:0;width:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container.ie6 .ps-scrollbar-y{font-size:0}.ps-container .ps-scrollbar-y-rail:hover .ps-scrollbar-y,.ps-container .ps-scrollbar-y-rail.hover .ps-scrollbar-y{background-color:#999}.ps-container.ie .ps-scrollbar-x,.ps-container.ie .ps-scrollbar-y{visibility:hidden}.ps-container.ie:hover .ps-scrollbar-x,.ps-container.ie:hover .ps-scrollbar-y,.ps-container.ie.hover .ps-scrollbar-x,.ps-container.ie.hover .ps-scrollbar-y{visibility:visible} \ No newline at end of file diff --git a/public/perfect-scrollbar.min.js b/public/perfect-scrollbar.min.js new file mode 100644 index 0000000..3720496 --- /dev/null +++ b/public/perfect-scrollbar.min.js @@ -0,0 +1,4 @@ +/*! perfect-scrollbar - v0.4.11 +* http://noraesae.github.com/perfect-scrollbar/ +* Copyright (c) 2014 Hyeonje Alex Jun; Licensed MIT */ +(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e){"use strict";var t={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},o=function(){var e=0;return function(){var t=e;return e+=1,".perfect-scrollbar-"+t}}();e.fn.perfectScrollbar=function(r,n){return this.each(function(){var l=e.extend(!0,{},t),s=e(this);if("object"==typeof r?e.extend(!0,l,r):n=r,"update"===n)return s.data("perfect-scrollbar-update")&&s.data("perfect-scrollbar-update")(),s;if("destroy"===n)return s.data("perfect-scrollbar-destroy")&&s.data("perfect-scrollbar-destroy")(),s;if(s.data("perfect-scrollbar"))return s.data("perfect-scrollbar");s.addClass("ps-container");var a,c,i,u,d,p,f,h,v,b,g=e("
").appendTo(s),m=e("
").appendTo(s),w=e("
").appendTo(g),T=e("
").appendTo(m),L=parseInt(g.css("bottom"),10),y=L===L,I=y?null:parseInt(g.css("top"),10),S=parseInt(m.css("right"),10),x=S===S,C=x?null:parseInt(m.css("left"),10),P="rtl"===s.css("direction"),D=o(),X=parseInt(g.css("borderLeftWidth"),10)+parseInt(g.css("borderRightWidth"),10),Y=parseInt(g.css("borderTopWidth"),10)+parseInt(g.css("borderBottomWidth"),10),k=function(e,t){var o=e+t,r=u-v;b=0>o?0:o>r?r:o;var n=parseInt(b*(p-u)/(u-v),10);s.scrollTop(n),y?g.css({bottom:L-n}):g.css({top:I+n})},M=function(e,t){var o=e+t,r=i-f;h=0>o?0:o>r?r:o;var n=parseInt(h*(d-i)/(i-f),10);s.scrollLeft(n),x?m.css({right:S-n}):m.css({left:C+n})},W=function(e){return l.minScrollbarLength&&(e=Math.max(e,l.minScrollbarLength)),l.maxScrollbarLength&&(e=Math.min(e,l.maxScrollbarLength)),e},j=function(){var e={width:i,display:a?"inherit":"none"};e.left=P?s.scrollLeft()+i-d:s.scrollLeft(),y?e.bottom=L-s.scrollTop():e.top=I+s.scrollTop(),g.css(e);var t={top:s.scrollTop(),height:u,display:c?"inherit":"none"};x?t.right=P?d-s.scrollLeft()-S-T.outerWidth():S-s.scrollLeft():t.left=P?s.scrollLeft()+2*i-d-C-T.outerWidth():C+s.scrollLeft(),m.css(t),w.css({left:h,width:f-X}),T.css({top:b,height:v-Y}),a?s.addClass("ps-active-x"):s.removeClass("ps-active-x"),c?s.addClass("ps-active-y"):s.removeClass("ps-active-y")},E=function(){i=l.includePadding?s.innerWidth():s.width(),u=l.includePadding?s.innerHeight():s.height(),d=s.prop("scrollWidth"),p=s.prop("scrollHeight"),!l.suppressScrollX&&d>i+l.scrollXMarginOffset?(a=!0,f=W(parseInt(i*i/d,10)),h=parseInt(s.scrollLeft()*(i-f)/(d-i),10)):(a=!1,f=0,h=0,s.scrollLeft(0)),!l.suppressScrollY&&p>u+l.scrollYMarginOffset?(c=!0,v=W(parseInt(u*u/p,10)),b=parseInt(s.scrollTop()*(u-v)/(p-u),10)):(c=!1,v=0,b=0,s.scrollTop(0)),b>=u-v&&(b=u-v),h>=i-f&&(h=i-f),j()},O=function(){var t,o;w.bind("mousedown"+D,function(e){o=e.pageX,t=w.position().left,g.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+D,function(e){g.hasClass("in-scrolling")&&(M(t,e.pageX-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+D,function(){g.hasClass("in-scrolling")&&g.removeClass("in-scrolling")}),t=o=null},q=function(){var t,o;T.bind("mousedown"+D,function(e){o=e.pageY,t=T.position().top,m.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+D,function(e){m.hasClass("in-scrolling")&&(k(t,e.pageY-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+D,function(){m.hasClass("in-scrolling")&&m.removeClass("in-scrolling")}),t=o=null},A=function(e,t){var o=s.scrollTop();if(0===e){if(!c)return!1;if(0===o&&t>0||o>=p-u&&0>t)return!l.wheelPropagation}var r=s.scrollLeft();if(0===t){if(!a)return!1;if(0===r&&0>e||r>=d-i&&e>0)return!l.wheelPropagation}return!0},B=function(){l.wheelSpeed/=10;var e=!1;s.bind("mousewheel"+D,function(t,o,r,n){var i=t.deltaX*t.deltaFactor||r,u=t.deltaY*t.deltaFactor||n;e=!1,l.useBothWheelAxes?c&&!a?(u?s.scrollTop(s.scrollTop()-u*l.wheelSpeed):s.scrollTop(s.scrollTop()+i*l.wheelSpeed),e=!0):a&&!c&&(i?s.scrollLeft(s.scrollLeft()+i*l.wheelSpeed):s.scrollLeft(s.scrollLeft()-u*l.wheelSpeed),e=!0):(s.scrollTop(s.scrollTop()-u*l.wheelSpeed),s.scrollLeft(s.scrollLeft()+i*l.wheelSpeed)),E(),e=e||A(i,u),e&&(t.stopPropagation(),t.preventDefault())}),s.bind("MozMousePixelScroll"+D,function(t){e&&t.preventDefault()})},F=function(){var t=!1;s.bind("mouseenter"+D,function(){t=!0}),s.bind("mouseleave"+D,function(){t=!1});var o=!1;e(document).bind("keydown"+D,function(r){if(!(r.isDefaultPrevented&&r.isDefaultPrevented()||!t||e(document.activeElement).is(":input,[contenteditable]"))){var n=0,l=0;switch(r.which){case 37:n=-30;break;case 38:l=30;break;case 39:n=30;break;case 40:l=-30;break;case 33:l=90;break;case 32:case 34:l=-90;break;case 35:l=-u;break;case 36:l=u;break;default:return}s.scrollTop(s.scrollTop()-l),s.scrollLeft(s.scrollLeft()+n),o=A(n,l),o&&r.preventDefault()}})},H=function(){var e=function(e){e.stopPropagation()};T.bind("click"+D,e),m.bind("click"+D,function(e){var t=parseInt(v/2,10),o=e.pageY-m.offset().top-t,r=u-v,n=o/r;0>n?n=0:n>1&&(n=1),s.scrollTop((p-u)*n)}),w.bind("click"+D,e),g.bind("click"+D,function(e){var t=parseInt(f/2,10),o=e.pageX-g.offset().left-t,r=i-f,n=o/r;0>n?n=0:n>1&&(n=1),s.scrollLeft((d-i)*n)})},K=function(){var t=function(e,t){s.scrollTop(s.scrollTop()-t),s.scrollLeft(s.scrollLeft()-e),E()},o={},r=0,n={},l=null,a=!1;e(window).bind("touchstart"+D,function(){a=!0}),e(window).bind("touchend"+D,function(){a=!1}),s.bind("touchstart"+D,function(e){var t=e.originalEvent.targetTouches[0];o.pageX=t.pageX,o.pageY=t.pageY,r=(new Date).getTime(),null!==l&&clearInterval(l),e.stopPropagation()}),s.bind("touchmove"+D,function(e){if(!a&&1===e.originalEvent.targetTouches.length){var l=e.originalEvent.targetTouches[0],s={};s.pageX=l.pageX,s.pageY=l.pageY;var c=s.pageX-o.pageX,i=s.pageY-o.pageY;t(c,i),o=s;var u=(new Date).getTime(),d=u-r;d>0&&(n.x=c/d,n.y=i/d,r=u),e.preventDefault()}}),s.bind("touchend"+D,function(){clearInterval(l),l=setInterval(function(){return.01>Math.abs(n.x)&&.01>Math.abs(n.y)?(clearInterval(l),void 0):(t(30*n.x,30*n.y),n.x*=.8,n.y*=.8,void 0)},10)})},z=function(){s.bind("scroll"+D,function(){E()})},Q=function(){s.unbind(D),e(window).unbind(D),e(document).unbind(D),s.data("perfect-scrollbar",null),s.data("perfect-scrollbar-update",null),s.data("perfect-scrollbar-destroy",null),w.remove(),T.remove(),g.remove(),m.remove(),g=m=w=T=a=c=i=u=d=p=f=h=L=y=I=v=b=S=x=C=P=D=null},R=function(t){s.addClass("ie").addClass("ie"+t);var o=function(){var t=function(){e(this).addClass("hover")},o=function(){e(this).removeClass("hover")};s.bind("mouseenter"+D,t).bind("mouseleave"+D,o),g.bind("mouseenter"+D,t).bind("mouseleave"+D,o),m.bind("mouseenter"+D,t).bind("mouseleave"+D,o),w.bind("mouseenter"+D,t).bind("mouseleave"+D,o),T.bind("mouseenter"+D,t).bind("mouseleave"+D,o)},r=function(){j=function(){var e={left:h+s.scrollLeft(),width:f};y?e.bottom=L:e.top=I,w.css(e);var t={top:b+s.scrollTop(),height:v};x?t.right=S:t.left=C,T.css(t),w.hide().show(),T.hide().show()}};6===t&&(o(),r())},G="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,J=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&"msie"===e[1]&&R(parseInt(e[2],10)),E(),z(),O(),q(),H(),G&&K(),s.mousewheel&&B(),l.useKeyboard&&F(),s.data("perfect-scrollbar",s),s.data("perfect-scrollbar-update",E),s.data("perfect-scrollbar-destroy",Q)};return J(),s})}}); \ No newline at end of file diff --git a/public/perfect-scrollbar.with-mousewheel.min.js b/public/perfect-scrollbar.with-mousewheel.min.js new file mode 100644 index 0000000..ee02199 --- /dev/null +++ b/public/perfect-scrollbar.with-mousewheel.min.js @@ -0,0 +1,4 @@ +/*! perfect-scrollbar - v0.4.11 +* http://noraesae.github.com/perfect-scrollbar/ +* Copyright (c) 2014 Hyeonje Alex Jun; Licensed MIT */ +(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e){"use strict";var t={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},o=function(){var e=0;return function(){var t=e;return e+=1,".perfect-scrollbar-"+t}}();e.fn.perfectScrollbar=function(n,r){return this.each(function(){var l=e.extend(!0,{},t),s=e(this);if("object"==typeof n?e.extend(!0,l,n):r=n,"update"===r)return s.data("perfect-scrollbar-update")&&s.data("perfect-scrollbar-update")(),s;if("destroy"===r)return s.data("perfect-scrollbar-destroy")&&s.data("perfect-scrollbar-destroy")(),s;if(s.data("perfect-scrollbar"))return s.data("perfect-scrollbar");s.addClass("ps-container");var a,i,c,u,d,p,f,h,v,b,g=e("
").appendTo(s),m=e("
").appendTo(s),w=e("
").appendTo(g),L=e("
").appendTo(m),T=parseInt(g.css("bottom"),10),y=T===T,x=y?null:parseInt(g.css("top"),10),S=parseInt(m.css("right"),10),I=S===S,P=I?null:parseInt(m.css("left"),10),D="rtl"===s.css("direction"),M=o(),C=parseInt(g.css("borderLeftWidth"),10)+parseInt(g.css("borderRightWidth"),10),X=parseInt(g.css("borderTopWidth"),10)+parseInt(g.css("borderBottomWidth"),10),Y=function(e,t){var o=e+t,n=u-v;b=0>o?0:o>n?n:o;var r=parseInt(b*(p-u)/(u-v),10);s.scrollTop(r),y?g.css({bottom:T-r}):g.css({top:x+r})},k=function(e,t){var o=e+t,n=c-f;h=0>o?0:o>n?n:o;var r=parseInt(h*(d-c)/(c-f),10);s.scrollLeft(r),I?m.css({right:S-r}):m.css({left:P+r})},W=function(e){return l.minScrollbarLength&&(e=Math.max(e,l.minScrollbarLength)),l.maxScrollbarLength&&(e=Math.min(e,l.maxScrollbarLength)),e},j=function(){var e={width:c,display:a?"inherit":"none"};e.left=D?s.scrollLeft()+c-d:s.scrollLeft(),y?e.bottom=T-s.scrollTop():e.top=x+s.scrollTop(),g.css(e);var t={top:s.scrollTop(),height:u,display:i?"inherit":"none"};I?t.right=D?d-s.scrollLeft()-S-L.outerWidth():S-s.scrollLeft():t.left=D?s.scrollLeft()+2*c-d-P-L.outerWidth():P+s.scrollLeft(),m.css(t),w.css({left:h,width:f-C}),L.css({top:b,height:v-X}),a?s.addClass("ps-active-x"):s.removeClass("ps-active-x"),i?s.addClass("ps-active-y"):s.removeClass("ps-active-y")},O=function(){c=l.includePadding?s.innerWidth():s.width(),u=l.includePadding?s.innerHeight():s.height(),d=s.prop("scrollWidth"),p=s.prop("scrollHeight"),!l.suppressScrollX&&d>c+l.scrollXMarginOffset?(a=!0,f=W(parseInt(c*c/d,10)),h=parseInt(s.scrollLeft()*(c-f)/(d-c),10)):(a=!1,f=0,h=0,s.scrollLeft(0)),!l.suppressScrollY&&p>u+l.scrollYMarginOffset?(i=!0,v=W(parseInt(u*u/p,10)),b=parseInt(s.scrollTop()*(u-v)/(p-u),10)):(i=!1,v=0,b=0,s.scrollTop(0)),b>=u-v&&(b=u-v),h>=c-f&&(h=c-f),j()},E=function(){var t,o;w.bind("mousedown"+M,function(e){o=e.pageX,t=w.position().left,g.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+M,function(e){g.hasClass("in-scrolling")&&(k(t,e.pageX-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+M,function(){g.hasClass("in-scrolling")&&g.removeClass("in-scrolling")}),t=o=null},H=function(){var t,o;L.bind("mousedown"+M,function(e){o=e.pageY,t=L.position().top,m.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+M,function(e){m.hasClass("in-scrolling")&&(Y(t,e.pageY-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+M,function(){m.hasClass("in-scrolling")&&m.removeClass("in-scrolling")}),t=o=null},A=function(e,t){var o=s.scrollTop();if(0===e){if(!i)return!1;if(0===o&&t>0||o>=p-u&&0>t)return!l.wheelPropagation}var n=s.scrollLeft();if(0===t){if(!a)return!1;if(0===n&&0>e||n>=d-c&&e>0)return!l.wheelPropagation}return!0},q=function(){l.wheelSpeed/=10;var e=!1;s.bind("mousewheel"+M,function(t,o,n,r){var c=t.deltaX*t.deltaFactor||n,u=t.deltaY*t.deltaFactor||r;e=!1,l.useBothWheelAxes?i&&!a?(u?s.scrollTop(s.scrollTop()-u*l.wheelSpeed):s.scrollTop(s.scrollTop()+c*l.wheelSpeed),e=!0):a&&!i&&(c?s.scrollLeft(s.scrollLeft()+c*l.wheelSpeed):s.scrollLeft(s.scrollLeft()-u*l.wheelSpeed),e=!0):(s.scrollTop(s.scrollTop()-u*l.wheelSpeed),s.scrollLeft(s.scrollLeft()+c*l.wheelSpeed)),O(),e=e||A(c,u),e&&(t.stopPropagation(),t.preventDefault())}),s.bind("MozMousePixelScroll"+M,function(t){e&&t.preventDefault()})},B=function(){var t=!1;s.bind("mouseenter"+M,function(){t=!0}),s.bind("mouseleave"+M,function(){t=!1});var o=!1;e(document).bind("keydown"+M,function(n){if(!(n.isDefaultPrevented&&n.isDefaultPrevented()||!t||e(document.activeElement).is(":input,[contenteditable]"))){var r=0,l=0;switch(n.which){case 37:r=-30;break;case 38:l=30;break;case 39:r=30;break;case 40:l=-30;break;case 33:l=90;break;case 32:case 34:l=-90;break;case 35:l=-u;break;case 36:l=u;break;default:return}s.scrollTop(s.scrollTop()-l),s.scrollLeft(s.scrollLeft()+r),o=A(r,l),o&&n.preventDefault()}})},F=function(){var e=function(e){e.stopPropagation()};L.bind("click"+M,e),m.bind("click"+M,function(e){var t=parseInt(v/2,10),o=e.pageY-m.offset().top-t,n=u-v,r=o/n;0>r?r=0:r>1&&(r=1),s.scrollTop((p-u)*r)}),w.bind("click"+M,e),g.bind("click"+M,function(e){var t=parseInt(f/2,10),o=e.pageX-g.offset().left-t,n=c-f,r=o/n;0>r?r=0:r>1&&(r=1),s.scrollLeft((d-c)*r)})},z=function(){var t=function(e,t){s.scrollTop(s.scrollTop()-t),s.scrollLeft(s.scrollLeft()-e),O()},o={},n=0,r={},l=null,a=!1;e(window).bind("touchstart"+M,function(){a=!0}),e(window).bind("touchend"+M,function(){a=!1}),s.bind("touchstart"+M,function(e){var t=e.originalEvent.targetTouches[0];o.pageX=t.pageX,o.pageY=t.pageY,n=(new Date).getTime(),null!==l&&clearInterval(l),e.stopPropagation()}),s.bind("touchmove"+M,function(e){if(!a&&1===e.originalEvent.targetTouches.length){var l=e.originalEvent.targetTouches[0],s={};s.pageX=l.pageX,s.pageY=l.pageY;var i=s.pageX-o.pageX,c=s.pageY-o.pageY;t(i,c),o=s;var u=(new Date).getTime(),d=u-n;d>0&&(r.x=i/d,r.y=c/d,n=u),e.preventDefault()}}),s.bind("touchend"+M,function(){clearInterval(l),l=setInterval(function(){return.01>Math.abs(r.x)&&.01>Math.abs(r.y)?(clearInterval(l),void 0):(t(30*r.x,30*r.y),r.x*=.8,r.y*=.8,void 0)},10)})},K=function(){s.bind("scroll"+M,function(){O()})},Q=function(){s.unbind(M),e(window).unbind(M),e(document).unbind(M),s.data("perfect-scrollbar",null),s.data("perfect-scrollbar-update",null),s.data("perfect-scrollbar-destroy",null),w.remove(),L.remove(),g.remove(),m.remove(),g=m=w=L=a=i=c=u=d=p=f=h=T=y=x=v=b=S=I=P=D=M=null},R=function(t){s.addClass("ie").addClass("ie"+t);var o=function(){var t=function(){e(this).addClass("hover")},o=function(){e(this).removeClass("hover")};s.bind("mouseenter"+M,t).bind("mouseleave"+M,o),g.bind("mouseenter"+M,t).bind("mouseleave"+M,o),m.bind("mouseenter"+M,t).bind("mouseleave"+M,o),w.bind("mouseenter"+M,t).bind("mouseleave"+M,o),L.bind("mouseenter"+M,t).bind("mouseleave"+M,o)},n=function(){j=function(){var e={left:h+s.scrollLeft(),width:f};y?e.bottom=T:e.top=x,w.css(e);var t={top:b+s.scrollTop(),height:v};I?t.right=S:t.left=P,L.css(t),w.hide().show(),L.hide().show()}};6===t&&(o(),n())},N="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,Z=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&"msie"===e[1]&&R(parseInt(e[2],10)),O(),K(),E(),H(),F(),N&&z(),s.mousewheel&&q(),l.useKeyboard&&B(),s.data("perfect-scrollbar",s),s.data("perfect-scrollbar-update",O),s.data("perfect-scrollbar-destroy",Q)};return Z(),s})}}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var s=t||window.event,a=i.call(arguments,1),c=0,u=0,d=0,p=0;if(t=e.event.fix(s),t.type="mousewheel","detail"in s&&(d=-1*s.detail),"wheelDelta"in s&&(d=s.wheelDelta),"wheelDeltaY"in s&&(d=s.wheelDeltaY),"wheelDeltaX"in s&&(u=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(u=-1*d,d=0),c=0===d?u:d,"deltaY"in s&&(d=-1*s.deltaY,c=d),"deltaX"in s&&(u=s.deltaX,0===d&&(c=-1*u)),0!==d||0!==u){if(1===s.deltaMode){var f=e.data(this,"mousewheel-line-height");c*=f,d*=f,u*=f}else if(2===s.deltaMode){var h=e.data(this,"mousewheel-page-height");c*=h,d*=h,u*=h}return p=Math.max(Math.abs(d),Math.abs(u)),(!l||l>p)&&(l=p,n(s,p)&&(l/=40)),n(s,p)&&(c/=40,u/=40,d/=40),c=Math[c>=1?"floor":"ceil"](c/l),u=Math[u>=1?"floor":"ceil"](u/l),d=Math[d>=1?"floor":"ceil"](d/l),t.deltaX=u,t.deltaY=d,t.deltaFactor=l,t.deltaMode=0,a.unshift(t,c,u,d),r&&clearTimeout(r),r=setTimeout(o,200),(e.event.dispatch||e.event.handle).apply(this,a)}}function o(){l=null}function n(e,t){return u.settings.adjustOldDeltas&&"mousewheel"===e.type&&0===t%120}var r,l,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],a="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(e.event.fixHooks)for(var c=s.length;c;)e.event.fixHooks[s[--c]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var o=a.length;o;)this.addEventListener(a[--o],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=a.length;e;)this.removeEventListener(a[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}); \ No newline at end of file diff --git a/public/proposals_list.js b/public/proposals_list.js index 0a3e28a..23d6b93 100644 --- a/public/proposals_list.js +++ b/public/proposals_list.js @@ -13,19 +13,25 @@ jQuery(document).ready(function($) { }); function proposalsScroll() { + $('.topic-content').data('jscroll', null); + $('.topic-content').jscroll({ + loadingHtml: 'LoadingLoading...', + nextSelector: 'div.more a' + }); $('.proposals').data('jscroll', null); $('.proposals').jscroll({ loadingHtml: 'LoadingLoading...', nextSelector: 'div.more a' }); - $('.proposals').trigger('scroll.jscroll'); } - proposalsScroll(); + $('.filters .random').click(); $('.proposals_list .filters a.order').on('ajax:success', function(event, data, status, xhr) { - $('.proposals_list .filters a.order').removeClass('selected'); + $(this).parents('div.proposals_list').find('.filters a.order').removeClass('selected'); $(this).addClass('selected'); $(this).parents('div.proposals_list').find('.proposals').html(data); proposalsScroll(); }); + + $('.topic-content').perfectScrollbar({suppressScrollX: true}); }); diff --git a/public/style.css b/public/style.css index 33a5e6f..e510037 100644 --- a/public/style.css +++ b/public/style.css @@ -6,13 +6,10 @@ } .proposal { - background: rgb(236, 236, 236); width: 100%; min-width: 272px; vertical-align: top; margin: 12px 13px 12px 0; - box-shadow: 5px 5px 5px -2px #ddd; - height: 100px; } .article-body-proposals-discussion-plugin_discussion .actions, @@ -21,8 +18,7 @@ } .proposal .content, .proposal .score, .proposal .topic { - display: table-cell; - border-right: 1px solid; + display: inline-block; border-color: rgb(201, 201, 201); padding: 5px; vertical-align: middle; @@ -34,17 +30,17 @@ width: 24%; } .proposal .score { - width: 8%; + width: 5%; text-align: center; } .proposal .content:hover, .proposal .topic:hover { - background: rgba(0, 0, 0, 0.1); + background: rgb(230, 230, 230); } .proposal .title { font-weight: bold; - font-size: 15px; + font-size: 12px; } #article .proposal a:visited, #article .proposal a { @@ -54,19 +50,11 @@ display: inline-block; } -#article .proposal .title a { - padding: 4px 0px; -} - .proposal .content { - width: 68%; + width: 84%; color: rgb(83, 83, 83); vertical-align: top; - height: 90px; -} - -.proposal .abstract { - padding-top: 4px; + position: relative; } form .proposals-discussion-plugin textarea { @@ -82,9 +70,8 @@ form .proposals-discussion-plugin .body textarea { } .topic-color { - width: 9px; - float: left; - height: 100%; + width: 100%; + height: 5px; } .topics .topic { @@ -100,18 +87,9 @@ form .proposals-discussion-plugin .body textarea { height: 100%; } -#article .topics .topic a { - text-decoration: none; - display: inline-block; - width: 95%; - height: 100%; - padding-left: 5px; - font-weight: bold; - font-size: 14px; -} - .proposals_list .filters { float: right; + margin-top: 4px; } #article .proposals_list .filters a { text-decoration: none; @@ -122,3 +100,44 @@ form .proposals-discussion-plugin .body textarea { .proposals_list .filters a.selected { font-weight: bold; } +#content .proposals_list h5 { + float: left; + margin: 0; +} +.topics .topic-item { + width: 48%; + float: left; + margin: 6px; + height: 450px; + font-size: 10px; + box-shadow: 5px 5px 5px -2px #ddd; +} + +#content .topic-item h2, #article .article-body-proposals-discussion-plugin_topic h2 { + background-color: #C4C4C4; + margin: 0; +} + +#content .topic-item h2 a, #article .article-body-proposals-discussion-plugin_topic h2 a { + text-decoration: none; + padding: 10px; + display: inline-block; + width: 94%; + color: white; +} +.topic-item .topic-content, #article .article-body-proposals-discussion-plugin_topic .topic-content { + padding: 5px 7px 5px 2px; + position: relative; + height: 86%; + overflow: hidden; +} +.topic-content .description { + font-size: 11px; +} +#article-header > h1 { + display: none; +} +.proposal .content .social { + position: absolute; + top: -18px; +} diff --git a/views/content_viewer/_proposal_card.html.erb b/views/content_viewer/_proposal_card.html.erb index d1c287d..4d5bde2 100644 --- a/views/content_viewer/_proposal_card.html.erb +++ b/views/content_viewer/_proposal_card.html.erb @@ -1,5 +1,7 @@
-
+
+ <%= proposal_card.comments_count %> +
<%= link_to proposal_card.name, proposal_card.view_url %> @@ -11,10 +13,4 @@ <%= link_to strip_tags(proposal_card.abstract), proposal_card.view_url %>
-
- <%= proposal_card.comments_count %> -
-
- <%= link_to proposal_card.topic.title, proposal_card.topic.view_url %> -
diff --git a/views/content_viewer/_proposals_list.html.erb b/views/content_viewer/_proposals_list.html.erb index ba0a426..1ed48cc 100644 --- a/views/content_viewer/_proposals_list.html.erb +++ b/views/content_viewer/_proposals_list.html.erb @@ -1,9 +1,6 @@ - -<%= javascript_include_tag 'plugins/proposals_discussion/proposals_list.js' %> - <% extend ProposalsDiscussionPlugin::ProposalsListHelper %> -<% private_proposals = user ? @page.proposals.private(user) : [] %> +<% private_proposals = user ? holder.proposals.private(user) : [] %> <% unless private_proposals.empty? %>
<%= _('My private proposals') %>
@@ -13,7 +10,6 @@ <% order ||= 'random' %>
-
<%= _('Proposals') %>
<% [[_('Random'), :random], [_('Aplhabetical'), :alphabetical]].each_with_index do |order, i| %> <%= link_to order.first, url_for({:controller => 'proposals_discussion_plugin_public', :action => 'load_proposals', :holder_id => holder.id, :profile => profile.identifier, :order => order.second}), :remote => true, :class => "order #{order.second} #{i==0 ? 'selected':''}" %> diff --git a/views/content_viewer/discussion.html.erb b/views/content_viewer/discussion.html.erb index fb33d1a..607d8eb 100644 --- a/views/content_viewer/discussion.html.erb +++ b/views/content_viewer/discussion.html.erb @@ -1,3 +1,9 @@ +<%= stylesheet_link_tag 'plugins/proposals_discussion/perfect-scrollbar.min.css' %> +<%= javascript_include_tag 'plugins/proposals_discussion/perfect-scrollbar.min.js' %> +<%= javascript_include_tag 'plugins/proposals_discussion/perfect-scrollbar.with-mousewheel.min.js' %> +<%= javascript_include_tag 'plugins/proposals_discussion/jquery.jscroll.min.js' %> +<%= javascript_include_tag 'plugins/proposals_discussion/proposals_list.js' %> +
<%= @page.body %>
@@ -10,20 +16,17 @@
<% end %> -
-

<%= _('Discussion Topics') %>

- <% @page.topics.includes(:profile).each do |topic| %> -
-
- <%= link_to topic.title, topic.view_url %> -
+
+ <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'select_topic', :parent_id => @page.id}), :class => 'button with-text icon-add' do %> + <%= _("Send your proposal") %> <% end %>
-
- <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'select_topic', :parent_id => @page.id}), :class => 'button with-text icon-add' do %> - <%= _("Send my proposal") %> +
+ <% @page.topics.includes(:profile).each do |topic| %> +
+ <%= render :file => 'content_viewer/topic', :locals => {:topic => topic, :list_view => true} %> +
<% end %>
-<%= render :partial => 'content_viewer/proposals_list', :locals => {:holder => @page} %> diff --git a/views/content_viewer/topic.html.erb b/views/content_viewer/topic.html.erb index 0e100a7..f029d4a 100644 --- a/views/content_viewer/topic.html.erb +++ b/views/content_viewer/topic.html.erb @@ -1,33 +1,51 @@ +<% list_view ||= false %> + +<% unless list_view %> + <%= javascript_include_tag 'plugins/proposals_discussion/jquery.jscroll.min.js' %> + <%= javascript_include_tag 'plugins/proposals_discussion/proposals_list.js' %> +<% end %> + +
+

<%= link_to topic.title, topic.view_url %>

+ +
+
- <%= @page.body %> + <%= topic.body %>
-

<%= @page.discussion.title %>

+<% unless list_view %> +

<%= topic.discussion.title %>

<%= _('Number of Proposals: ') %> - <%= @page.proposals.count %> + <%= topic.proposals.count %>
<%= _('Number of Participants: ') %> - <%= @page.proposals_authors.count %> + <%= topic.proposals_authors.count %>
<%= _('Number of Comments: ') %> - <%= @page.proposals_comments.count %> + <%= topic.proposals_comments.count %>
<%= _('Most active: ') %> - <% @page.most_active_participants.each do |author| %> + <% topic.most_active_participants.each do |author| %> <%= link_to profile_image(author, :icon), author.url, :title => author.name %> <% end %>
+<% end %> +<% unless list_view %>
- <%= link_to url_for({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => @page.id}), :class => 'button with-text icon-add' do %> - <%= _("Send my proposal") %> + <%= link_to url_for({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => topic.id}), :class => 'button with-text icon-add' do %> + <%= _("Send your proposal") %> <% end %>
+<% end %> + +<%= render :partial => 'content_viewer/proposals_list', :locals => {:holder => topic} %> -<%= render :partial => 'content_viewer/proposals_list', :locals => {:holder => @page} %> +
-- libgit2 0.21.2