Browse Source

Placeholder formatting help.

Rafał Pitoń 12 years ago
parent
commit
9e657404d5

+ 6 - 0
misago/apps/help.py

@@ -0,0 +1,6 @@
+from django.template import RequestContext
+from misago.shortcuts import render_to_response
+
+def markdown(request):
+    return render_to_response('help_md.html',
+                              context_instance=RequestContext(request));

+ 9 - 9
misago/apps/threadtype/jumps.py

@@ -188,15 +188,15 @@ class UpvotePostBaseView(JumpView):
                         self.post.user.karma_n -= 1
                         self.post.user.karma_n -= 1
             except Karma.DoesNotExist:
             except Karma.DoesNotExist:
                 vote = Karma()
                 vote = Karma()
-            vote.forum = self.forum
-            vote.thread = self.thread
-            vote.post = self.post
-            vote.user = request.user
-            vote.user_name = request.user.username
-            vote.user_slug = request.user.username_slug
-            vote.date = timezone.now()
-            vote.ip = request.session.get_ip(request)
-            vote.agent = request.META.get('HTTP_USER_AGENT')
+                vote.forum = self.forum
+                vote.thread = self.thread
+                vote.post = self.post
+                vote.user = request.user
+                vote.user_name = request.user.username
+                vote.user_slug = request.user.username_slug
+                vote.date = timezone.now()
+                vote.ip = request.session.get_ip(request)
+                vote.agent = request.META.get('HTTP_USER_AGENT')
             self.make_vote(request, vote)
             self.make_vote(request, vote)
             if vote.pk:
             if vote.pk:
                 vote.save(force_update=True)
                 vote.save(force_update=True)

+ 1 - 0
misago/urls.py

@@ -13,6 +13,7 @@ urlpatterns = patterns('misago.apps',
     url(r'^alerts/$', 'alerts.alerts', name="alerts"),
     url(r'^alerts/$', 'alerts.alerts', name="alerts"),
     url(r'^news/$', 'newsfeed.newsfeed', name="newsfeed"),
     url(r'^news/$', 'newsfeed.newsfeed', name="newsfeed"),
     url(r'^tos/$', 'tos.tos', name="tos"),
     url(r'^tos/$', 'tos.tos', name="tos"),
+    url(r'^markdown/$', 'help.markdown', name="help_md"),
     url(r'^forum-map/$', 'forummap.forum_map', name="forum_map"),
     url(r'^forum-map/$', 'forummap.forum_map', name="forum_map"),
     url(r'^popular/$', 'popularthreads.popular_threads', name="popular_threads"),
     url(r'^popular/$', 'popularthreads.popular_threads', name="popular_threads"),
     url(r'^popular/(?P<page>[1-9]([0-9]+)?)/$', 'popularthreads.popular_threads', name="popular_threads"),
     url(r'^popular/(?P<page>[1-9]([0-9]+)?)/$', 'popularthreads.popular_threads', name="popular_threads"),

+ 2 - 1
static/cranefly/css/cranefly.css

@@ -959,7 +959,8 @@ a.btn-link:hover,a.btn-link:active,a.btn-link:focus{opacity:.9;filter:alpha(opac
 .editor{background-color:#fff;border:1px solid #e6e6e6;border-radius:3px}.editor .editor-error{padding:10.5px;padding-bottom:0;margin-bottom:-10.5px}.editor .editor-error .help-block{color:#cf402e;font-weight:bold}
 .editor{background-color:#fff;border:1px solid #e6e6e6;border-radius:3px}.editor .editor-error{padding:10.5px;padding-bottom:0;margin-bottom:-10.5px}.editor .editor-error .help-block{color:#cf402e;font-weight:bold}
 .editor .editor-input{padding:10.5px}.editor .editor-input>div{margin-right:2px}.editor .editor-input>div textarea{border:none;box-shadow:none;margin:-10.5px;padding:10.5px;width:100%;font-family:Monaco,Menlo,Consolas,"Courier New",monospace}
 .editor .editor-input{padding:10.5px}.editor .editor-input>div{margin-right:2px}.editor .editor-input>div textarea{border:none;box-shadow:none;margin:-10.5px;padding:10.5px;width:100%;font-family:Monaco,Menlo,Consolas,"Courier New",monospace}
 .editor .editor-actions{border-top:1px solid #e6e6e6;overflow:auto;padding:10.5px}.editor .editor-actions>.btn{margin-left:14px}
 .editor .editor-actions{border-top:1px solid #e6e6e6;overflow:auto;padding:10.5px}.editor .editor-actions>.btn{margin-left:14px}
-.editor .editor-actions .editor-tools{margin:0}.editor .editor-actions .editor-tools li{float:left;margin-right:10.5px}.editor .editor-actions .editor-tools li .btn{padding-left:7px;padding-right:7px}
+.editor .editor-actions .editor-tools{margin:0;margin-right:10.5px}.editor .editor-actions .editor-tools li{float:left;margin-right:10.5px}.editor .editor-actions .editor-tools li .btn{padding-left:7px;padding-right:7px}
+.editor .editor-actions .editor-help{line-height:30.5px}
 .form-container .editor{border-color:#ccc}.form-container .editor .editor-actions{border-top-color:#ccc}
 .form-container .editor{border-color:#ccc}.form-container .editor .editor-actions{border-top-color:#ccc}
 .error-page{text-align:center}.error-page .error-color{color:#cf402e}
 .error-page{text-align:center}.error-page .error-color{color:#cf402e}
 .error-page .error-ban-reason{border:1px solid #cf402e;border-radius:3px;background-color:#fbeeed;background-image:repeating-linear-gradient(45deg, transparent, transparent 5px, #fdf6f5 5px, #fdf6f5 10px);-webkit-box-shadow:0 0 0 3px #e38b80;-moz-box-shadow:0 0 0 3px #e38b80;box-shadow:0 0 0 3px #e38b80;padding:11px 19px;text-align:left}.error-page .error-ban-reason :last-child{margin-bottom:0;padding-bottom:0}
 .error-page .error-ban-reason{border:1px solid #cf402e;border-radius:3px;background-color:#fbeeed;background-image:repeating-linear-gradient(45deg, transparent, transparent 5px, #fdf6f5 5px, #fdf6f5 10px);-webkit-box-shadow:0 0 0 3px #e38b80;-moz-box-shadow:0 0 0 3px #e38b80;box-shadow:0 0 0 3px #e38b80;padding:11px 19px;text-align:left}.error-page .error-ban-reason :last-child{margin-bottom:0;padding-bottom:0}

+ 6 - 1
static/cranefly/css/cranefly/editor.less

@@ -31,7 +31,7 @@
         width: 100%;
         width: 100%;
 
 
         font-family: @monoFontFamily;
         font-family: @monoFontFamily;
-      } 
+      }
     }
     }
   }
   }
 
 
@@ -46,6 +46,7 @@
 
 
     .editor-tools {
     .editor-tools {
       margin: 0px;
       margin: 0px;
+      margin-right: @editorPadding;
 
 
       li {
       li {
         float: left;
         float: left;
@@ -57,6 +58,10 @@
         }
         }
       }
       }
     }
     }
+
+    .editor-help {
+    	line-height: @baseLineHeight + @editorPadding;
+    }
   }
   }
 }
 }
 
 

+ 1 - 0
templates/cranefly/editor.html

@@ -21,6 +21,7 @@
       {% if not hide_images %}<li{% if hide_links %} class="divider"{% endif %}><a href="#" class="tooltip-top btn editor-image" title="{% trans %}Insert Image{% endtrans %}"><i class="icon-picture"></i></a></li>{% endif %}
       {% if not hide_images %}<li{% if hide_links %} class="divider"{% endif %}><a href="#" class="tooltip-top btn editor-image" title="{% trans %}Insert Image{% endtrans %}"><i class="icon-picture"></i></a></li>{% endif %}
       {% if not hide_hr %}<li class="divider"><a href="#" class="tooltip-top btn editor-hr" title="{% trans %}Insert Horizontal Line{% endtrans %}"><i class="icon-minus"></i></a></li>{% endif %}
       {% if not hide_hr %}<li class="divider"><a href="#" class="tooltip-top btn editor-hr" title="{% trans %}Insert Horizontal Line{% endtrans %}"><i class="icon-minus"></i></a></li>{% endif %}
     </ul>
     </ul>
+    <a href="{{ url('help_md') }}" class="editor-help" target="_blank">{% trans %}Formatting Help{% endtrans %}</a>
     <button name="save" type="submit" class="btn btn-primary pull-right">{{ submit_button }}</button>
     <button name="save" type="submit" class="btn btn-primary pull-right">{{ submit_button }}</button>
     {% if extra %}{{ extra }}{% endif %}
     {% if extra %}{{ extra }}{% endif %}
   </div>
   </div>

+ 40 - 0
templates/cranefly/help_md.html

@@ -0,0 +1,40 @@
+{% extends "cranefly/layout.html" %}
+{% import "cranefly/macros.html" as macros with context %}
+
+{% block title %}{{ macros.page_title(title=_('Misago Flavored Markdown')) }}{% endblock %}
+
+{% block container %}
+<div class="page-header header-primary">
+  <div class="container">
+    {{ messages_list(messages) }}
+    <h1>{% trans %}Misago Flavored Markdown{% endtrans %}</h1>
+  </div>
+</div>
+
+<div class="container container-primary">
+  <p class="lead">{% trans %}Your message is composed of blocks like paragraphs, headers, lists or code listings. All blocks with exception of code blocks may contain in-line elements like links, images, movies, underlining and bolding.{% endtrans %}</p>
+
+  <h1>{% trans %}Block level elements{% endtrans %}</h1>
+  <p>{% trans %}Lorem ipsum dolor met.{% endtrans %}</p>
+
+  <h2>{% trans %}Paragraphs{% endtrans %}</h2>
+  <p>{% trans %}Paragraphs are blocks of text separated by empty lines.{% endtrans %}</p>
+  <blockcode>
+    <pre>Nunc interdum ipsum a accumsan suscipit. Maecenas eget nunc sollicitudin augue convallis pulvinar. Duis dapibus, ante eget fringilla eleifend, metus odio bibendum risus, eu placerat diam diam gravida magna. Integer in blandit arcu, eget pretium ligula.
+
+Curabitur tempus convallis orci, sed hendrerit mi. Donec lectus lectus, rutrum et pharetra quis, viverra at enim. Maecenas at dolor sed erat consectetur lacinia vitae at turpis. In faucibus nisl at tortor rutrum, non convallis enim placerat.</pre>
+  </blockcode>
+
+  <p>{% trans %}Input above becomes two paragraphs:{% endtrans %}</p>
+
+  <div class="well markdown">
+    <p>Nunc interdum ipsum a accumsan suscipit. Maecenas eget nunc sollicitudin augue convallis pulvinar. Duis dapibus, ante eget fringilla eleifend, metus odio bibendum risus, eu placerat diam diam gravida magna. Integer in blandit arcu, eget pretium ligula.</p>
+    <p>Curabitur tempus convallis orci, sed hendrerit mi. Donec lectus lectus, rutrum et pharetra quis, viverra at enim. Maecenas at dolor sed erat consectetur lacinia vitae at turpis. In faucibus nisl at tortor rutrum, non convallis enim placerat.</p>
+  </div>
+
+  <hr>
+
+  <h2>{% trans %}Headers{% endtrans %}</h2>
+  <p>{% trans %}You can use headers to title sections of your message. Each header block level element which means{% endtrans %}</p>
+</div>
+{% endblock %}