Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

reference better name for "citation" plugin

  • Loading branch information...
commit 1ca91063b295b746810ba336023ed481b4e42de6 1 parent 7c5832a
@WardCunningham authored
View
2  client/plugins/meta-factory.coffee
@@ -87,7 +87,7 @@ window.plugins.factory =
[ignore, item.site, item.slug] = found
$.getJSON "http://#{item.site}/#{item.slug}.json", (remote) ->
wiki.log 'remote', remote
- item.type = 'federatedWiki'
+ item.type = 'reference'
item.title = remote.title || item.slug
item.text = remote.synopsis || remote.story[0].text || remote.story[1].text || 'A recently found federated wiki site.'
syncEditAction()
View
2  client/plugins/meta-factory.js
@@ -126,7 +126,7 @@
ignore = found[0], item.site = found[1], item.slug = found[2];
return $.getJSON("http://" + item.site + "/" + item.slug + ".json", function(remote) {
wiki.log('remote', remote);
- item.type = 'federatedWiki';
+ item.type = 'reference';
item.title = remote.title || item.slug;
item.text = remote.synopsis || remote.story[0].text || remote.story[1].text || 'A recently found federated wiki site.';
return syncEditAction();
View
4 client/plugins/method/pages/bottles-of-beer-methods
@@ -72,7 +72,7 @@
"text": "Caution: We have yet to make the order of operations within methods reliably deterministic. If you see errors or unexpected values try refreshing the page."
},
{
- "type": "federatedWiki",
+ "type": "reference",
"id": "7938d7d8442d3248",
"site": "ward.fed.wiki.org",
"slug": "99-bottles-of-beer",
@@ -324,7 +324,7 @@
"type": "edit",
"id": "7938d7d8442d3248",
"item": {
- "type": "federatedWiki",
+ "type": "reference",
"id": "7938d7d8442d3248",
"site": "ward.fed.wiki.org",
"slug": "99-bottles-of-beer",
View
13 client/plugins/reference/reference.coffee
@@ -0,0 +1,13 @@
+window.plugins.reference =
+ emit: (div, item) ->
+ slug = item.slug or 'welcome-visitors'
+ site = item.site
+ wiki.log 'emit', slug, 'site', site
+ wiki.resolveFrom site, ->
+ title = wiki.resolveLinks "[[#{item.title || slug}]]"
+ div.append($("<h3 style='margin-bottom:3px;'><img src='//#{site}/favicon.png' class='remote' width='16px' height='16px' title='#{site}'> #{title}</h3>"))
+ div.append($("<div>#{wiki.resolveLinks(item.text)}</div>"))
+ # div.append($("<div class='cite' style='margin-top:3px;'>http://#{site}/view/#{slug}</div>"))
+ div.find('img').data('slug', slug).data('site', site)
+ bind: (div, item) ->
+ div.dblclick -> wiki.textEditor div, item
View
25 client/plugins/reference/reference.js
@@ -0,0 +1,25 @@
+// Generated by CoffeeScript 1.3.3
+(function() {
+
+ window.plugins.reference = {
+ emit: function(div, item) {
+ var site, slug;
+ slug = item.slug || 'welcome-visitors';
+ site = item.site;
+ wiki.log('emit', slug, 'site', site);
+ return wiki.resolveFrom(site, function() {
+ var title;
+ title = wiki.resolveLinks("[[" + (item.title || slug) + "]]");
+ div.append($("<h3 style='margin-bottom:3px;'><img src='//" + site + "/favicon.png' class='remote' width='16px' height='16px' title='" + site + "'> " + title + "</h3>"));
+ div.append($("<div>" + (wiki.resolveLinks(item.text)) + "</div>"));
+ return div.find('img').data('slug', slug).data('site', site);
+ });
+ },
+ bind: function(div, item) {
+ return div.dblclick(function() {
+ return wiki.textEditor(div, item);
+ });
+ }
+ };
+
+}).call(this);
View
1  client/style.css
@@ -50,6 +50,7 @@ footer span {
width: 16px;
}
+img.remote,
footer img {
width: 16px;
height: 16px;
View
6 server/sinatra/server.rb
@@ -221,7 +221,7 @@ def identity
text << " #{action['item']['type']}" if action['item']
text << "<br>#{action['item']['text']}" if action['item'] && action['item']['text']
site = "#{request.host}#{request.port==80 ? '' : ':'+request.port.to_s}"
- story << {'type' => 'federatedWiki', 'site' => site, 'slug' => page['name'], 'title' => page['title'], 'text' => text, 'id' => RandomId.generate}
+ story << {'type' => 'reference', 'site' => site, 'slug' => page['name'], 'title' => page['title'], 'text' => text, 'id' => RandomId.generate}
end
end
page = {'title' => 'Recent Changes', 'story' => story}
@@ -257,7 +257,7 @@ def identity
# page = farm.get(slug)
# next if page['story'].length == 0
# site = "#{site}#{request.port==80 ? '' : ':'+request.port.to_s}"
- # story << {'type' => 'federatedWiki', 'site' => site, 'slug' => slug, 'title' => page['title'], 'text' => "", 'id' => RandomId.generate}
+ # story << {'type' => 'reference', 'site' => site, 'slug' => slug, 'title' => page['title'], 'text' => "", 'id' => RandomId.generate}
# end
# end
# page = {'title' => 'Recent Changes', 'story' => story}
@@ -359,7 +359,7 @@ def identity
farm_page(spawn).put slug, page
end
citation = {
- "type"=> "federatedWiki",
+ "type"=> "reference",
"id"=> RandomId.generate,
"site"=> site,
"slug"=> "recent-changes",
View
2  spec/server_spec.rb
@@ -156,7 +156,7 @@ def create_sample_page
it "has a listing of the single recent change" do
@json['story'][1]['slug'].should == "a-page"
@json['story'][1]['title'].should == "A Page"
- @json['story'][1]['type'].should == 'federatedWiki'
+ @json['story'][1]['type'].should == 'reference'
end
end
end

0 comments on commit 1ca9106

Please sign in to comment.
Something went wrong with that request. Please try again.