Zine

open source content publishing system


Changeset 1304:7148358f6d8d


Ignore:
Timestamp:
01/11/10 23:41:00 (2 years ago)
Author:
mitsuhiko
Branch:
default
rebase_source:
eb8b8bc2f5191339c815cffe75463873380a1be8
Message:

Heavily improved new-style notifications.

Location:
zine
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zine/shared/admin/style.css

    r1294 r1304  
    829829div.contents div.notification-messages { 
    830830    position: fixed; 
    831     top: 10px; 
    832     right: 20px; 
     831    top: 0; 
     832    right: 10px; 
    833833    width: 250px; 
     834    height: 0px; 
    834835    font-size: 13px; 
    835836} 
     
    837838div.contents div.message { 
    838839    border: 1px solid #B4D2E7; 
    839     margin: 0 -10px 10px -10px; 
     840    margin: 10px 0; 
    840841    padding: 8px 8px 8px 32px; 
    841842    -moz-border-radius: 3px; 
  • zine/shared/js/Admin.js

    r1294 r1304  
    1414  (function() { 
    1515    var shuttingDown = false; 
    16     var active = false; 
    17     var msg = null, left, top, right, bottom; 
     16    var hiddenMsg = null, left, top, right, bottom; 
    1817    var messages = $('div.message').hide().fadeIn('slow'); 
    1918 
    2019    function fadeInMsg() { 
    21       if (msg) 
    22         msg.css('visibility', 'visible').animate({'opacity': '1.0'}, 'fast'); 
    23       msg = null; 
     20      hiddenMsg.css('visibility', 'visible').animate({opacity: '1.0'}); 
     21      hiddenMsg = null; 
    2422    } 
    2523 
     
    2725      if (shuttingDown && !$(this).is('.message-error')) 
    2826        return; 
    29       if (msg) 
     27      if (hiddenMsg) 
    3028        fadeInMsg(); 
    31       msg = $(this); 
     29      var msg = $(this); 
    3230      var pos = msg.offset(); 
    3331      left = pos.left - 2, top = pos.top - 2; 
     
    3634      bottom = top + msg.height() + parseInt(msg.css('padding-top')) + 
    3735               parseInt(msg.css('padding-bottom')) + 4; 
    38       msg.animate({ 
    39         opacity:      '0.01' 
    40       }, 'fast', function() { msg.css('visibility', 'hidden'); }); 
     36      msg.animate({opacity: '0.01'}, 'fast', function() { 
     37        hiddenMsg = msg; 
     38        hiddenMsg.css('visibility', 'hidden'); 
     39      }); 
    4140    }); 
    4241 
    4342    $(document).mousemove(function(evt) { 
    44       if (!msg) 
     43      if (!hiddenMsg) 
    4544        return; 
    4645      if (evt.clientX < left || evt.clientX > right || 
  • zine/views/admin.py

    r1287 r1304  
    153153            ('import', url_for('admin/import'), _(u'Import')), 
    154154            ('export', url_for('admin/export'), _(u'Export')), 
    155             ('log', url_for('admin/log'), _('Log')) 
     155            ('log', url_for('admin/log'), _(u'Log')) 
    156156        ] 
    157157 
     
    181181                                        request.user.has_privilege(BLOG_ADMIN): 
    182182        flash(_(u'Zine is in maintenance mode. Don\'t forget to ' 
    183                 u'<a href="%s">turn it off again</a> once you finish your ' 
     183                u'turn it off again once you finish your ' 
    184184                u'changes.') % url_for('admin/maintenance')) 
    185185 
     
    251251        for url in form.find_new_links(): 
    252252            host = urlparse(url)[1].decode('utf-8', 'ignore') 
    253             html_url = '<a href="%s">%s</a>' % ( 
    254                 escape(url, True), 
    255                 escape(host) 
    256             ) 
    257253            try: 
    258254                pingback(this_url, url) 
     
    260256                if not e.ignore_silently: 
    261257                    flash(_(u'Could not ping %(url)s: %(error)s') % { 
    262                         'url': html_url, 
     258                        'url':   escape(host), 
    263259                        'error': e.message 
    264260                    }, 'error') 
     
    380376            if post is None: 
    381377                post = form.make_post() 
    382                 msg = _('The entry %s was created successfully.') 
     378                msg = _(u'The entry “%s” was created successfully.') 
    383379            else: 
    384380                form.save_changes() 
    385                 msg = _('The entry %s was updated successfully.') 
    386  
    387             flash(msg % u'<a href="%s">%s</a>' % (escape(url_for(post)), 
    388                                                   escape(post.title))) 
     381                msg = _(u'The entry “%s” was updated successfully.') 
     382 
     383            flash(msg % escape(post.title)) 
    389384 
    390385            db.commit() 
     
    416411            form.add_invalid_redirect_target('admin/edit_post', post_id=post.id) 
    417412            form.delete_post() 
    418             flash(_(u'The entry %s was deleted successfully.') % 
     413            flash(_(u'The entry “%s” was deleted successfully.') % 
    419414                  escape(post.title), 'remove') 
    420415            db.commit() 
     
    459454            if post is None: 
    460455                post = form.make_post() 
    461                 msg = _('The page %s was created successfully.') 
     456                msg = _(u'The page “%s” was created successfully.') 
    462457            else: 
    463458                form.save_changes() 
    464                 msg = _('The page %s was updated successfully.') 
    465  
    466             flash(msg % u'<a href="%s">%s</a>' % (escape(url_for(post)), 
    467                                                   escape(post.title))) 
     459                msg = _(u'The page “%s” was updated successfully.') 
     460 
     461            flash(msg % escape(post.title)) 
    468462 
    469463            db.commit() 
     
    495489            form.add_invalid_redirect_target('admin/edit_post', post_id=post.id) 
    496490            form.delete_post() 
    497             flash(_(u'The page %s was deleted successfully.') % 
     491            flash(_(u'The page “%s” was deleted successfully.') % 
    498492                  escape(post.title), 'remove') 
    499493            db.commit() 
     
    548542            elif 'delete_all' in request.form: 
    549543                if identifier not in ('spam', 'blocked'): 
    550                     flash(_('“Delete All” can only be issued for “Spam” and ' 
    551                             '“Blocked” comment types.'), 'error') 
     544                    flash(_(u'“Delete All” can only be issued for “Spam” and ' 
     545                            u'“Blocked” comment types.'), 'error') 
    552546                elif 'confirm' in request.form: 
    553547                    comments = query.all() 
     
    793787    return render_admin_response('admin/mark_comment.html', 
    794788                                 'comments.overview', form=form.as_widget(), 
    795                                  form_action=_('Spam')) 
     789                                 form_action=_(u'Spam')) 
    796790 
    797791@require_admin_privilege(MODERATE_COMMENTS | MODERATE_OWN_ENTRIES | 
     
    850844            if category is None: 
    851845                category = form.make_category() 
    852                 msg = _(u'Category %s created successfully.') 
     846                msg = _(u'Category “%s” created successfully.') 
    853847                msg_type = 'add' 
    854848            else: 
    855849                form.save_changes() 
    856                 msg = _(u'Category %s updated successfully.') 
     850                msg = _(u'Category “%s” updated successfully.') 
    857851                msg_type = 'info' 
    858852            db.commit() 
    859             html_category_detail = u'<a href="%s">%s</a>' % ( 
    860                 escape(url_for(category)), 
    861                 escape(category.name) 
    862             ) 
    863             flash(msg % html_category_detail, msg_type) 
     853            flash(msg % escape(category.name), msg_type) 
    864854            return redirect_to('admin/manage_categories') 
    865855 
     
    923913            if user is None: 
    924914                user = form.make_user() 
    925                 msg = _(u'User %s created successfully.') 
     915                msg = _(u'User “%s” created successfully.') 
    926916                icon = 'add' 
    927917            else: 
    928918                form.save_changes() 
    929                 msg = _(u'User %s edited successfully.') 
     919                msg = _(u'User “%s” edited successfully.') 
    930920                icon = 'info' 
    931921            db.commit() 
    932             html_user_detail = u'<a href="%s">%s</a>' % ( 
    933                 escape(url_for(user)), 
    934                 escape(user.username) 
    935             ) 
    936             flash(msg % html_user_detail, icon) 
     922            flash(msg % escape(user.username), icon) 
    937923            if request.form.get('save'): 
    938924                return form.redirect('admin/manage_users') 
     
    991977            if group is None: 
    992978                group = form.make_group() 
    993                 msg = _(u'Group %s created successfully.') 
     979                msg = _(u'Group “%s” created successfully.') 
    994980                icon = 'add' 
    995981            else: 
    996982                form.save_changes() 
    997                 msg = _(u'Group %s edited successfully.') 
     983                msg = _(u'Group “%s” edited successfully.') 
    998984                icon = 'info' 
    999985            db.commit() 
    1000             html_group_detail = u'<a href="%s">%s</a>' % ( 
    1001                 escape(url_for(group)), 
    1002                 escape(group.name)) 
    1003             flash(msg % html_group_detail, icon) 
     986            flash(msg % escape(group.name), icon) 
    1004987 
    1005988            if request.form.get('save'): 
     
    11231106    if request.method == 'POST' and form.validate(request.form): 
    11241107        form.apply() 
    1125         flash(_('Plugin configuration changed'), 'configure') 
     1108        flash(_(u'Plugin configuration changed'), 'configure') 
    11261109 
    11271110        new_plugin = request.files.get('new_plugin') 
     
    14161399    if request.method == 'POST' and form.validate(request.form): 
    14171400        form.apply() 
    1418         flash(_('Log changes saved.'), 'configure') 
     1401        flash(_(u'Log changes saved.'), 'configure') 
    14191402        return redirect_to('admin/log', page=page.number) 
    14201403    return render_admin_response('admin/log.html', 'system.log', 
Note: See TracChangeset for help on using the changeset viewer.