Ignore:
Timestamp:
Apr 8, 2010 3:39:31 PM (14 years ago)
Author:
kroman0
Message:

Rewrited kss to jquery and added some features

Location:
quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/skins/quintagroup_plonecomments
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/skins/quintagroup_plonecomments/discussion_edit_form.cpt

    r1631 r2087  
    3434        <fieldset> 
    3535 
    36             <legend i18n:translate="legend_edit_comment">Edit comment</legend> 
    37             <p i18n:translate="description_edit_comment"> 
     36            <legend i18n:domain="quintagroup.plonecomments" 
     37                    i18n:translate="legend_edit_comment">Edit comment</legend> 
     38            <p i18n:domain="quintagroup.plonecomments" 
     39               i18n:translate="description_edit_comment"> 
    3840                You can edit a comment by filling out the form below. Plain text 
    3941                formatting. 
  • quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/skins/quintagroup_plonecomments/discussion_reply_form.cpt

    r1631 r2087  
    252252                       i18n:attributes="value label_save;" 
    253253                       tal:attributes="name string:discussion_reply:method;" /> 
     254                <input class="standalone" 
     255                       type="submit" 
     256                       value="Cancel" 
     257                       name="form.button.Cancel" 
     258                       i18n:attributes="value label_cancel;" /> 
    254259 
    255260            </div> 
  • quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/skins/quintagroup_plonecomments/discussion_reply_form.cpt.metadata

    r822 r2087  
    44[validators] 
    55validators = validate_talkback 
     6validators..Cancel= 
    67 
    78[actions] 
    8 action.success = traverse_to:string:discussion_reply 
     9action.success = redirect_to:string:view 
     10action.success..Save = traverse_to:string:discussion_reply 
    911action.failure = traverse_to:string:discussion_reply_form 
  • quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/skins/quintagroup_plonecomments/qcomments.js

    r1201 r2087  
    1 function render_abuse_report_form(comment_id) { 
    2     jq('form.report_abuse').bind("submit", function(event){ 
     1function render_edit_form(comment_id, form_name) { 
     2    var cholder = jq("#"+comment_id).parent(); 
     3    var cform = jq("form[name='"+form_name+"']",cholder); 
     4    var url = jq(cform).attr("action"); 
     5    var cspan = jq("#span-forms-holder-"+comment_id); 
     6    cspan.hide().empty() 
     7    jq(cform).bind("submit", function(event){ 
    38        event.preventDefault(); 
    49    }); 
    5     var render_button = 'input#input-render-abuse-cancel-' + comment_id; 
    6     jq(render_button).attr('disabled', 'disabled'); 
    7     var form = 'span#span-reply-form-' + comment_id; 
    8     jq(form).slideToggle(500); 
    9     var holder = 'span#span-reply-form-holder-' + comment_id; 
    10     var cancel_button = holder + ' input#input-report-abuse-cancel'; 
    11     var qq = jq(cancel_button); 
    12     jq(cancel_button).attr('comment_id', comment_id); 
     10    jq.get(url, 
     11    function(data){ 
     12        jq("input", cform).attr("disabled", "disabled"); 
     13        ddt = jq("form[name='edit_form']", data)[0]; 
     14        cspan.append(ddt).slideToggle(1000); 
     15        jq("input[name='form.button.Cancel']",cspan).attr("onclick", "javascript:remove_edit_form("+comment_id+",'"+form_name+"')"); 
     16    }); 
    1317} 
    1418 
    15 function remove_abuse_report_form(comment_id, html) { 
    16     jq('form.report_abuse').bind("submit", function(event){ 
     19function remove_edit_form(comment_id, form_name) { 
     20    var cholder = jq("#"+comment_id).parent(); 
     21    var cform = jq(cholder).find("form[name='"+form_name+"']"); 
     22    var cspan = jq("#span-forms-holder-"+comment_id); 
     23    jq("form",cspan).bind("submit", function(event){ 
    1724        event.preventDefault(); 
    1825    }); 
    19     var form = 'span#span-reply-form-' + comment_id; 
    20     jq(form).fadeOut(); 
    21     var render_button = 'input#input-render-abuse-cancel-' + comment_id; 
    22     jq(render_button).attr('disabled', ''); 
    23     if (html != undefined) { 
    24         var holder = 'span#span-abuse-count-holder-' + comment_id; 
    25         jq(holder).append(html); 
    26     } 
     26    jq("input", cform).attr("disabled", ''); 
     27    cspan.fadeOut(); 
    2728} 
    2829 
    29 kukit.actionsGlobalRegistry.register("remove_abuse_report_form", function(oper) { 
    30     var comment_id = oper.parms.comment_id; 
    31     var html = oper.parms.html 
    32     remove_abuse_report_form(comment_id, html); 
    33 }); 
    34 kukit.commandsGlobalRegistry.registerFromAction('remove_abuse_report_form', kukit.cr.makeSelectorCommand); 
     30function render_delete_comment(comment_id) { 
     31    var cholder = jq("#"+comment_id).parent(); 
     32    var cform = jq("form[name='delete']",cholder); 
     33    var url = jq(cform).attr("action"); 
     34    jq(cform).bind("submit", function(event){ 
     35        event.preventDefault(); 
     36    }); 
     37    jq(cholder).detach() 
     38    jq.post(url); 
     39} 
     40 
     41function render_comment_form() { 
     42    var cform = jq("form#reply"); 
     43    var url = jq(cform).attr("action"); 
     44    jq(cform).bind("submit", function(event){ 
     45        event.preventDefault(); 
     46    }); 
     47    jq.get(url, 
     48    function(data){ 
     49        ddt = jq("form[name='edit_form']", data)[0]; 
     50        jq(cform).replaceWith(ddt); 
     51    }); 
     52} 
     53 
  • quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/skins/quintagroup_plonecomments/report_abuse_form.cpt

    r1631 r2087  
    2121                        Iterator python:modules['Products.CMFPlone'].IndexIterator; 
    2222                        tabindex python:Iterator(mainSlot=False); 
    23                         isAnon context/@@plone_portal_state/anonymous; 
     23                        isAnon context/@@plone_portal_state/anonymous|string:False; 
    2424                        member context/@@plone_portal_state/member; 
    2525                        thread python:putils.getDiscussionThread(here); 
     
    8080                                comment_id context/id"> 
    8181                    <metal:macro define-macro="form" 
    82                             tal:define="isAjaxReportAbuseEnabled view/ajax_report_abuse_enabled|python:portal.portal_properties.qPloneComments.enable_ajax_report_abuse; 
     82                            tal:define="isAjaxReportAbuseEnabled view/ajax_report_abuse_enabled|python:here.portal_properties.qPloneComments.enable_ajax_report_abuse; 
    8383                                        visible show_form|request/show_form|nothing; 
    8484                                        portal_url portal_url|view/portal_url; 
    85                                         tabindex tabindex|request/tabindex|view/tabindex; 
    86                                         member member|request/member|view/member;"> 
     85                                        isAnon isAnon|context/@@plone_portal_state/anonymous; 
     86                                        member member|context/@@plone_portal_state/member;"> 
    8787 
    8888                        <span tal:define="email_from_address portal/email_from_address|view/email_from_address; 
     
    198198                                                value="Send" 
    199199                                                type="submit" 
    200                                                 tal:attributes="comment_id comment_id; 
    201                                                                 class python:isAjaxReportAbuseEnabled  and 'context input-report-abuse-send' or 'context'" 
     200                                                class="context" 
     201                                                name="form.button.Send" 
     202                                                tal:attributes="comment_id comment_id" 
    202203                                                i18n:attributes="value label_send;" 
    203204                                                /> 
     
    207208                                                class="destructive" 
    208209                                                value="Cancel" 
    209                                                 type="button" 
    210                                                 tal:condition="isAjaxReportAbuseEnabled" 
    211                                                 tal:attributes="onclick string:javascript:remove_abuse_report_form(${comment_id})" 
     210                                                type="submit" 
     211                                                name="form.button.Cancel" 
    212212                                                i18n:attributes="value label_cancel;" 
    213213                                                /> 
  • quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/skins/quintagroup_plonecomments/report_abuse_form.cpt.metadata

    r1201 r2087  
    44[validators] 
    55validators = validate_report_abuse 
     6validators..Cancel= 
    67 
    78[actions] 
    8 action.success = traverse_to:string:report_abuse 
     9action.success = redirect_to:string:view 
     10action.success..Send = traverse_to:string:report_abuse 
    911action.failure = traverse_to:string:report_abuse_form 
Note: See TracChangeset for help on using the changeset viewer.