From 490eb7a32bca172182edad31811299fbbb77df54 Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Thu, 16 Aug 2012 17:31:05 -0400 Subject: [PATCH 1/2] styled changes, new article and delete pages --- lms/static/sass/course/wiki/_wiki.scss | 88 +++++++++- lms/templates/wiki/create.html | 49 ++++++ lms/templates/wiki/delete.html | 62 +++++++ lms/templates/wiki/history.html | 210 ++++++++++++++++++++++++ lms/templates/wiki/includes/editor.html | 2 +- lms/templates/wiki/includes/form.html | 36 ++++ 6 files changed, 444 insertions(+), 3 deletions(-) create mode 100644 lms/templates/wiki/create.html create mode 100644 lms/templates/wiki/delete.html create mode 100644 lms/templates/wiki/history.html create mode 100644 lms/templates/wiki/includes/form.html diff --git a/lms/static/sass/course/wiki/_wiki.scss b/lms/static/sass/course/wiki/_wiki.scss index 73a8268b26..24a556dd13 100644 --- a/lms/static/sass/course/wiki/_wiki.scss +++ b/lms/static/sass/course/wiki/_wiki.scss @@ -359,9 +359,15 @@ section.wiki { display: none; } + button { + font-family: $sans-serif; + } + .btn { @include button(simple, #eee); font-size: 0.8em; + margin-right: 5px; + line-height: 1.2em; &:hover { text-decoration: none; @@ -378,12 +384,29 @@ section.wiki { } } - #previewModal { + .modal { width: 960px; z-index: 9999; min-height: 500px; margin-left: -480px; - top: 200px; + top: 150px; + + .modal-header { + h1, p { + color: #fff; + } + + h1 { + margin: 3px 12px 8px; + font-size: 1.1em; + } + + p { + font-size: 0.9em; + margin: 5px 12px 20px; + line-height: 1em; + } + } .modal-body { padding-bottom: 8px; @@ -395,6 +418,10 @@ section.wiki { border: 0; } + .modal-footer { + margin: 12px; + } + .modal-footer .btn { margin-right: 10px; } @@ -421,6 +448,10 @@ section.wiki { border: 1px solid $light-gray; background: #f9f9f9; border-radius: 5px; + + a:hover { + text-decoration: none; + } } .collapse { @@ -435,6 +466,59 @@ section.wiki { + /*----------------- + + New + + -----------------*/ + + .new-article { + margin: auto; + float: none; + + .add-on { + line-height: 34px; + margin-right: 6px; + } + } + + #hint_id_slug { + display: inline-block; + font-size: 0.9em; + line-height: 1.3em; + margin-top: 9px; + } + + + + + + /*----------------- + + Delete + + -----------------*/ + + #div_id_confirm { + position: relative; + height: 30px; + margin: 40px 0; + + #id_confirm { + position: absolute; + top: 6px; + } + + label { + position: absolute; + left: 25px; + font-size: 1.4em; + } + } + + + + /*----------------- diff --git a/lms/templates/wiki/create.html b/lms/templates/wiki/create.html new file mode 100644 index 0000000000..25cc197bc4 --- /dev/null +++ b/lms/templates/wiki/create.html @@ -0,0 +1,49 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags %} +{% load url from future %} + +{% block pagetitle %}{% trans "Add new article" %}{% endblock %} + +{% block wiki_contents %} + + {% addtoblock "js" %} + + + {% endaddtoblock %} + +
+ + {% include "wiki/includes/editormedia.html" %} +

{% trans "Add new article" %}

+ +
+ {% wiki_form create_form %} +
+ + + {% trans "Go back" %} + + +
+
+ +
+ +{% endblock %} + diff --git a/lms/templates/wiki/delete.html b/lms/templates/wiki/delete.html new file mode 100644 index 0000000000..acabb79aad --- /dev/null +++ b/lms/templates/wiki/delete.html @@ -0,0 +1,62 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags %} +{% load url from future %} + +{% block pagetitle %}{% trans "Delete article" %}{% endblock %} + +{% block wiki_contents %} +

{% trans "Delete" %} "{{ article.current_revision.title }}"

+ + {% if cannot_delete_root %} +

{% trans "You cannot delete a root article." %}

+

{% trans "Go back" %}

+ {% else %} + + {% if cannot_delete_children %} + +

{% trans "You cannot delete this article because you do not have permission to delete articles with children. Try to remove the children manually one-by-one." %}

+ + {% endif %} + + {% if delete_children %} + +

{% trans "You are deleting an article. This means that its children will be deleted as well. If you choose to purge, children will also be purged!" %}

+ +

{% trans "Articles that will be deleted" %}

+ + + + {% endif %} + + {% if not cannot_delete_children %} +

{% trans "You are deleting an article. Please confirm." %}

+ +
+ {% wiki_form delete_form %} + +
+ + + {% trans "Go back" %} + + +
+
+ {% endif %} + + {% endif %} + +{% endblock %} + diff --git a/lms/templates/wiki/history.html b/lms/templates/wiki/history.html new file mode 100644 index 0000000000..0c120d5c54 --- /dev/null +++ b/lms/templates/wiki/history.html @@ -0,0 +1,210 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n sekizai_tags %} +{% load url from future %} + +{% block pagetitle %}{% trans "History" %}: {{ article.current_revision.title }}{% endblock %} + +{% block wiki_contents_tab %} + +{% addtoblock "js" %} + + + +{% endaddtoblock %} +{% addtoblock "css" %} + +{% endaddtoblock %} + + +
+
+ {% for revision in revisions %} + + {% endfor %} + + {% include "wiki/includes/pagination.html" %} + + {% if revisions.count > 1 %} +
+
+ {% if article|can_write:user %} + + {% else %} + + {% endif %} + +
+
+ + {% endif %} + +
+ + + + +
+ +{% endblock %} + diff --git a/lms/templates/wiki/includes/editor.html b/lms/templates/wiki/includes/editor.html index 10e2a2b645..736e6e0499 100644 --- a/lms/templates/wiki/includes/editor.html +++ b/lms/templates/wiki/includes/editor.html @@ -11,7 +11,7 @@
-
+
{% for plugin in sidebar %}
diff --git a/lms/templates/wiki/includes/form.html b/lms/templates/wiki/includes/form.html new file mode 100644 index 0000000000..c274a4d46f --- /dev/null +++ b/lms/templates/wiki/includes/form.html @@ -0,0 +1,36 @@ +{% csrf_token %} +{% if form.non_field_errors %} + {% if form_error_title %}

{{ form_error_title }}

{% endif %} + {% for error_message in form.non_field_errors %} +
+ {{ error_message }} +
+ {% endfor %} +{% endif %} + +{% for field in form %} + + {% if field.is_hidden %} + {{ field }} + {% else %} +
+ {% if field.label %} + + {% endif %} +
+ {{ field }} {% if field.field.required %}*{% endif %} + {% if field.errors %} + {% for error in field.errors %} +
{{ error }}
+ {% endfor %} + {% endif %} + {% if field.help_text %} +

{{ field.help_text|safe }}

+ {% endif %} +
+
+ {% endif %} + +{% endfor %} From ad45a44a7cdcdb359ed49773e9ba940aa7f34c4d Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Fri, 17 Aug 2012 09:37:42 -0400 Subject: [PATCH 2/2] added bootstrap js and other dependencies; tweaked settings template --- lms/static/js/bootstrap.min.js | 6 +++ lms/static/sass/course/wiki/_wiki.scss | 21 ++++++++--- lms/templates/wiki/base.html | 23 +++++++++++- lms/templates/wiki/settings.html | 52 ++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 lms/static/js/bootstrap.min.js create mode 100644 lms/templates/wiki/settings.html diff --git a/lms/static/js/bootstrap.min.js b/lms/static/js/bootstrap.min.js new file mode 100644 index 0000000000..1435698196 --- /dev/null +++ b/lms/static/js/bootstrap.min.js @@ -0,0 +1,6 @@ +/*! +* Bootstrap.js by @fat & @mdo +* Copyright 2012 Twitter, Inc. +* http://www.apache.org/licenses/LICENSE-2.0.txt +*/ +!function(a){a(function(){"use strict",a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=c,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(b){return b||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(a){return a||(this.paused=!0),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this,j=a.Event("slide");this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=a.extend({},a.fn.carousel.defaults,typeof c=="object"&&c);e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():f.interval&&e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e,f,g;if(c.is(".disabled, :disabled"))return;return f=c.attr("data-target"),f||(f=c.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=c.parent()),g=e.hasClass("open"),d(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('