Permalink
Browse files

reference better name for "citation" plugin

  • Loading branch information...
1 parent 7c5832a commit 1ca91063b295b746810ba336023ed481b4e42de6 @WardCunningham committed Aug 18, 2012
@@ -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()
Oops, something went wrong.
@@ -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",
@@ -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
Oops, something went wrong.
View
@@ -50,6 +50,7 @@ footer span {
width: 16px;
}
+img.remote,
footer img {
width: 16px;
height: 16px;
@@ -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
@@ -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.