One-Click S5 Template
Make it yet-easier to create S5 slideshows.
This commit is contained in:
parent
675df6b6c5
commit
5506f87f17
|
@ -81,6 +81,16 @@ class WikiReference < ActiveRecord::Base
|
||||||
row['name'].as_utf8 if row
|
row['name'].as_utf8 if row
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.page_categories(web, page_name)
|
||||||
|
query =
|
||||||
|
"SELECT referenced_name FROM wiki_references JOIN pages " +
|
||||||
|
"ON wiki_references.page_id = pages.id " +
|
||||||
|
"WHERE pages.name = ? " +
|
||||||
|
"AND wiki_references.link_type = '#{CATEGORY}' " +
|
||||||
|
"AND pages.web_id = '#{web.id}'"
|
||||||
|
names = connection.select_all(sanitize_sql([query, page_name])).map { |row| row['referenced_name'].as_utf8 }
|
||||||
|
end
|
||||||
|
|
||||||
def self.pages_in_category(web, category)
|
def self.pages_in_category(web, category)
|
||||||
query =
|
query =
|
||||||
"SELECT name FROM pages JOIN wiki_references " +
|
"SELECT name FROM pages JOIN wiki_references " +
|
||||||
|
|
|
@ -69,5 +69,9 @@ function cleanAuthorName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.forms["editForm"].elements["content"].focus();
|
document.forms["editForm"].elements["content"].focus();
|
||||||
|
<%- if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup) and
|
||||||
|
!WikiReference.page_categories(@web, @page.name).include?('S5-slideshow') -%>
|
||||||
|
addS5button('<%= CGI.escapeHTML(@page.name) %>');
|
||||||
|
<%- end -%>
|
||||||
//--><!]]>
|
//--><!]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -31,4 +31,7 @@ function cleanAuthorName() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.forms["editForm"].elements["content"].focus();
|
document.forms["editForm"].elements["content"].focus();
|
||||||
|
<%- if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup) -%>
|
||||||
|
addS5button('<%= CGI.escapeHTML(@page_name) %>');
|
||||||
|
<%- end -%>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -53,6 +53,24 @@ function mactionWorkarounds() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addS5button(page_name) {
|
||||||
|
var f = $('MarkupHelp');
|
||||||
|
if (f) {
|
||||||
|
var s5button = new Element('input', {id:'S5button', type:'button', value: 'Make this page an S5 slideshow'});
|
||||||
|
f.insert({top: s5button});
|
||||||
|
Event.observe(s5button, 'click', function(){
|
||||||
|
var preamble = "author: " + document.getElementById('author').value +
|
||||||
|
"\ncompany: \ntitle: " + page_name +
|
||||||
|
"\nsubtitle: \nslide_theme: default\nslide_footer: \nslide_subfooter: " +
|
||||||
|
"\n\n:category: S5-slideshow\n\n" + page_name +
|
||||||
|
"\n==============\n\nMy First Slide\n-----------------\n\n";
|
||||||
|
var content = document.getElementById('content');
|
||||||
|
content.value = preamble + content.value;
|
||||||
|
document.getElementById('S5button').hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateSize(elt, w, h) {
|
function updateSize(elt, w, h) {
|
||||||
// adjust to the size of the user's browser area.
|
// adjust to the size of the user's browser area.
|
||||||
// w and h are the original, unadjusted, width and height per row/column
|
// w and h are the original, unadjusted, width and height per row/column
|
||||||
|
|
Loading…
Reference in a new issue