Changeset 2541
- Timestamp:
- 02/24/10 21:31:33 (5 months ago)
- Location:
- branches/0.9/pylucid_project
- Files:
-
- 11 added
- 8 modified
-
apps/pylucid/models/pagecontent.py (modified) (3 diffs)
-
media/PyLucid/markup_help (added)
-
media/PyLucid/markup_help/creole_cheat_sheet.png (added)
-
pylucid_plugins/page_admin/admin_urls.py (modified) (2 diffs)
-
pylucid_plugins/page_admin/admin_views/edit_page.py (modified) (2 diffs)
-
pylucid_plugins/page_admin/admin_views/markup_help.py (added)
-
pylucid_plugins/page_admin/admin_views/page_list.py (added)
-
pylucid_plugins/page_admin/forms.py (modified) (2 diffs)
-
pylucid_plugins/page_admin/templates/page_admin/edit_inline_form.html (modified) (10 diffs)
-
pylucid_plugins/page_admin/templates/page_admin/includes/edit_content_page_buttons.html (modified) (2 diffs)
-
pylucid_plugins/page_admin/templates/page_admin/markup_help_base.html (added)
-
pylucid_plugins/page_admin/templates/page_admin/markup_help_creole.html (added)
-
pylucid_plugins/page_admin/templates/page_admin/markup_help_markdown.html (added)
-
pylucid_plugins/page_admin/templates/page_admin/markup_help_rest.html (added)
-
pylucid_plugins/page_admin/templates/page_admin/markup_help_textile.html (added)
-
pylucid_plugins/page_admin/templates/page_admin/markup_help_tinytextile.html (added)
-
pylucid_plugins/page_admin/templates/page_admin/page_list_popup.html (added)
-
pylucid_plugins/page_admin/templates/page_admin/tag_list_popup.html (modified) (2 diffs)
-
pylucid_plugins/page_admin/views.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9/pylucid_project/apps/pylucid/models/pagecontent.py
r2477 r2541 4 4 PyLucid models 5 5 ~~~~~~~~~~~~~~ 6 6 7 7 Last commit info: 8 8 ~~~~~~~~~~~~~~~~~ … … 43 43 """ 44 44 A normal CMS Page with text content. 45 45 46 46 signals connection is in pylucid_project.apps.pylucid.models.__init__ 47 47 … … 61 61 MARKUP_REST = 5 62 62 63 MARKUP_CHOICES = ( 64 (MARKUP_CREOLE , u'Creole wiki markup'), 65 (MARKUP_HTML , u'html'), 66 (MARKUP_HTML_EDITOR , u'html + JS-Editor'), 67 (MARKUP_TINYTEXTILE , u'textile'), 68 (MARKUP_TEXTILE , u'Textile (original)'), 69 (MARKUP_MARKDOWN , u'Markdown'), 70 (MARKUP_REST , u'ReStructuredText'), 63 MARKUP_DATA = ( 64 # [0] = markup ID (e.g. database integer field) 65 # [1] = lowcase, ASCII-only, no spaces (e.g. for filename) 66 # [2] = verbose name (used e.g. in select input form) 67 (MARKUP_CREOLE, u"creole", u'Creole wiki markup'), 68 (MARKUP_HTML, u"html", u'html'), 69 (MARKUP_HTML_EDITOR, u"htmleditor", u'html + JS-Editor'), 70 (MARKUP_TINYTEXTILE, u"tinytextile", u'tinytextile'), 71 (MARKUP_TEXTILE, u"textile", u'Textile (original)'), 72 (MARKUP_MARKDOWN, u"markdown", u'Markdown'), 73 (MARKUP_REST, u"rest", u'ReStructuredText'), 71 74 ) 75 # For djanfo choice form field: 76 MARKUP_CHOICES = [(data[0], data[2]) for data in MARKUP_DATA] 77 78 # For easy "get name by id": 72 79 MARKUP_DICT = dict(MARKUP_CHOICES) 80 81 # for mapping the ID with short name 82 MARKUP_SHORT_DICT = dict([(data[0], data[1]) for data in MARKUP_DATA]) 83 73 84 #-------------------------------------------------------------------------- 74 85 -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/admin_urls.py
r2477 r2541 24 24 from admin_views.page_order import page_order 25 25 from admin_views.tag_list import tag_list 26 from admin_views.page_list import page_list 27 from admin_views.markup_help import markup_help 26 28 from admin_views.translate_page import translate_page 27 29 … … 35 37 url(r'^translate/(?P<pagemeta_id>\d+?)/$', translate_page, name='PageAdmin-translate'), 36 38 url(r'^tag_list/$', tag_list, name='PageAdmin-tag_list'), 39 url(r'^page_list/$', page_list, name='PageAdmin-page_list'), 40 url(r'^markup_help/$', markup_help, name='PageAdmin-markup_help'), 37 41 url(r'^bulk_editor/$', bulk_editor, name='PageAdmin-bulk_editor'), 38 42 ) -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/admin_views/edit_page.py
r2494 r2541 64 64 "template_name": "page_admin/edit_content_page.html", 65 65 "abort_url": pagecontent.get_absolute_url(), 66 "pagecontent": pagecontent, 67 68 "markup_id_str": str(pagecontent.markup), 66 69 67 70 "all_forms": all_forms, # For display the form error list from all existing forms. … … 70 73 "pagemeta_form":pagemeta_form, 71 74 "pagecontent_form": pagecontent_form, 72 73 "pagelinklist_url": "#TODO",74 75 }) 75 76 return context -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/forms.py
r2512 r2541 110 110 exclude = ("pagemeta",) 111 111 112 def _markup_choices(*id_filter): 113 choices = [entry for entry in PageContent.MARKUP_CHOICES if entry[0] in id_filter] 114 return choices 115 112 116 113 117 class ConvertMarkupForm(forms.ModelForm): 114 118 # Use only supported markups for converting choice field 115 MARKUP_CHOICES = [entry for entry in PageContent.MARKUP_CHOICES 116 if entry[0] in ( 117 PageContent.MARKUP_CREOLE, PageContent.MARKUP_HTML, PageContent.MARKUP_HTML_EDITOR 118 ) 119 ] 120 dest_markup = forms.IntegerField( 121 widget=forms.Select(choices=MARKUP_CHOICES), 119 MARKUP_CHOICES = _markup_choices( 120 PageContent.MARKUP_CREOLE, PageContent.MARKUP_HTML, PageContent.MARKUP_HTML_EDITOR 121 ) 122 dest_markup = forms.ChoiceField( 123 choices=MARKUP_CHOICES, 122 124 help_text=_("convert the current page content to this new markup"), 123 125 ) … … 125 127 help_text=_("Display original html and a html diff."), 126 128 ) 129 def clean_markup(self): 130 return int(self.cleaned_data['markup']) 127 131 class Meta: 128 132 model = PageContent 129 133 fields = ('content',) 134 135 136 class SelectMarkupForm(forms.Form): 137 """ for page list admin view """ 138 markup = forms.ChoiceField( 139 choices=PageContent.MARKUP_CHOICES, 140 help_text=_("switch to other markup format"), 141 ) 142 143 144 class SelectMarkupHelpForm(forms.Form): 145 """ 146 For markup help admin view 147 There ist no help page for html code 148 """ 149 MARKUP_CHOICES = _markup_choices( 150 PageContent.MARKUP_CREOLE, 151 PageContent.MARKUP_TINYTEXTILE, 152 PageContent.MARKUP_TEXTILE, 153 PageContent.MARKUP_MARKDOWN, 154 PageContent.MARKUP_REST, 155 ) 156 markup = forms.ChoiceField( 157 choices=MARKUP_CHOICES, 158 help_text=_("switch to other markup help"), 159 ) 160 def clean_markup(self): 161 return int(self.cleaned_data['markup']) 162 163 164 # class Meta: 165 # model = PageContent 166 # fields = ('markup',) 130 167 131 168 -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/templates/page_admin/edit_inline_form.html
r2525 r2541 24 24 jQuery(document).ready(function($) { 25 25 log("edit_inline_form.html ready."); 26 26 27 27 $("#ajax_preview").show(); // unhide ajax preview button 28 28 29 29 $("#edit_page_form").change(function() { 30 30 log("edit page form change"); … … 41 41 $("#edit_page_form").before('<h2 class="ajax_msg">{% trans "submit" %}...</h2>'); 42 42 }); 43 43 44 44 // $(window).bind('beforeunload', function() { 45 45 // ^ this doesn't work! … … 47 47 log("beforeunload evend called. textarea_changed:" + textarea_changed); 48 48 if (textarea_changed == true) { 49 return "{% trans "Textarea has been changed! Changes are not saved if you leave." %}"; 49 return "{% trans "Textarea has been changed! Changes are not saved if you leave." %}"; 50 50 } 51 51 } 52 52 53 53 // from media/PyLucid/pylucid_js_tools.js 54 54 // pylucid_ajax_form_view('#edit_page_form'); 55 55 replace_openinwindow_links(); 56 56 57 57 var preview_div = $("#edit_page_preview"); 58 58 59 59 $("#ajax_preview").click(function() { 60 60 log("ajax preview clicked"); … … 62 62 $("#edit_page_preview").html('<h2 class="ajax_msg">{% trans "loading" %}...</h2>'); 63 63 $("#preview_fieldset").slideDown(); 64 64 65 65 var content = $("#id_content")[0].value; 66 66 67 67 var url = encodeURI("{{ preview_url }}"); 68 68 log("post:" + url); 69 69 log("content:" + content); 70 70 71 71 $.post(url, { "content": content, "preview": true }, function(form_html){ 72 72 preview_div.html(form_html); … … 74 74 }); 75 75 $("#submit_preview").hide(); 76 76 77 77 $("#abort_button").click(function() { 78 78 {% comment %} … … 82 82 self.location.href='{{ abort_url }}'; 83 83 }); 84 84 85 85 activate_resize_textarea_buttons(); 86 86 }); … … 97 97 {% trans 'Edit the CMS page' %} '<strong>{{ pagemeta.get_title|escape }}</strong>' 98 98 </legend> 99 <form action="{{ form_url }}" method="post" id="edit_page_form"> 99 <form action="{{ form_url }}" method="post" id="edit_page_form"> 100 100 <div class="helper_buttons"> 101 101 <input type="submit" name="save" value="{% trans 'save' %}" /> … … 105 105 </button> 106 106 <input type="button" id="abort_button" name="abort" value="{% trans 'abort' %}" /> 107 <a href="{ { pagelinklist_url}}" class="openinwindow" title="{% trans 'List of all pages for creating links' %}">107 <a href="{% url PageAdmin-page_list %}?markup={{ pagecontent.markup }}" class="openinwindow" title="{% trans 'List of all pages for creating links' %}"> 108 108 <button type="button" class="button">{% trans 'page list' %}</button> 109 109 </a> … … 111 111 <button type="button" class="button">{% trans 'tag list' %}</button> 112 112 </a> 113 114 {% if markup_id_str in "26" %} 115 <a href="{% url PageAdmin-markup_help %}?markup={{ pagecontent.markup }}" class="openinwindow" title="{% trans 'Markup help' %}"> 116 <button type="button" class="button">{% trans 'markup help' %}</button> 117 </a> 118 {% endif %} 119 113 120 <button type="button" class="button resize_textarea" id="bigger_id_content" title="{% trans 'makes the textarea bigger' %}"> 114 121 + … … 117 124 - 118 125 </button> 119 </div> 126 </div> 120 127 {% with edit_page_form as form %} 121 128 {% include "admin/pylucid/includes/pylucid_formset.html" %} -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/templates/page_admin/includes/edit_content_page_buttons.html
r2449 r2541 8 8 {% endif %} 9 9 <input type="submit" id="preview" name="preview" value="{% trans 'markup preview' %}" /> 10 <a href="{ { pagelinklist_url}}" class="openinwindow" title="{% trans 'List of all pages for creating links' %}">10 <a href="{% url PageAdmin-page_list %}?markup={{ pagecontent.markup }}" class="openinwindow" title="{% trans 'List of all pages for creating links' %}"> 11 11 <button type="button" class="button">{% trans 'page list' %}</button> 12 12 </a> … … 14 14 <button type="button" class="button">{% trans 'tag list' %}</button> 15 15 </a> 16 17 {% if markup_id_str in "26" %} 18 <a href="{% url PageAdmin-markup_help %}?markup={{ pagecontent.markup }}" class="openinwindow" title="{% trans 'Markup help' %}"> 19 <button type="button" class="button">{% trans 'markup help' %}</button> 20 </a> 21 {% endif %} 22 16 23 <button type="button" class="button resize_textarea" id="bigger_id_content" title="{% trans 'makes the textarea bigger' %}"> 17 24 + -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/templates/page_admin/tag_list_popup.html
r2517 r2541 1 1 {% extends "admin/base_site.html" %} 2 3 {% block extrahead %} 4 <style type="text/css"> 5 .example_link { 6 padding: 0px; 7 margin: 0px; 8 min-width: 400px; 9 width: 100%; 10 border: 0px!important; 11 } 12 tr { 13 background-color: #ffffff; 14 } 15 tr:hover { 16 background-color: #e0e0e0; 17 } 18 19 </style> 20 <script type="text/javascript"> 21 jQuery(document).ready(function($) { 22 $('.example_tag').each(function() { 23 // 'resize' every input field 24 var len = $(this).val().length; 25 $(this).attr("size", len); 26 $(this).attr("maxlength", len); 27 }); 28 $('.example_tag').hover(function() { 29 $(this).select(); 30 }); 31 }); 32 </script> 33 {% endblock extrahead %} 2 34 3 35 {% block content %} … … 14 46 <td title="for copy&paste into your cms page" class="nowrap"> 15 47 {% if lucid_tag.fallback_example %} 16 <i title="The plugin has no example in source code!">{{ lucid_tag.fallback_example }}</i>48 <input type="text" class="example_tag" title="automatic generated example" value='{{ lucid_tag.fallback_example }}'></input><br /> 17 49 {% else %} 18 {% iflucid_tag.examples %}19 {{ lucid_tag.examples|join:"<br />" }}20 {% end if%}50 {% for example in lucid_tag.examples %} 51 <input type="text" class="example_tag" value='{{ example }}'></input><br /> 52 {% endfor %} 21 53 {% endif %} 22 54 </td> -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/views.py
r2477 r2541 70 70 "preview_html": preview_html, 71 71 72 "pagelinklist_url": "#TODO", #FIXME ;) 73 "taglist_url": "#TODO", #FIXME ;) 72 "markup_id_str": str(pagecontent.markup), 74 73 75 74 "edit_page_form": edit_page_form,