Skip to content

Commit

Permalink
Merge pull request #195 from fedwiki/next
Browse files Browse the repository at this point in the history
Releasing Next version...
  • Loading branch information
WardCunningham authored May 6, 2017
2 parents 800a937 + 2311c23 commit c2b608f
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 85 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
node_js:
- "0.12"
- "4"
- "6"
- "7"
install:
Expand Down
1 change: 1 addition & 0 deletions lib/editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ escape = (string) ->

textEditor = ($item, item, option={}) ->
console.log 'textEditor', item.id, option
return unless $('.editEnable').is(':visible')

keydownHandler = (e) ->

Expand Down
17 changes: 9 additions & 8 deletions lib/factory.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ bind = ($item, item) ->
syncEditAction()

addReference = (data) ->
wiki.site(data.site).get "#{data-slug}.json", (remote) ->
item.type = 'reference'
item.site = data.site
item.slug = data.slug
item.title = remote.title || data.slug
item.text = synopsis remote
syncEditAction()
neighborhood.registerNeighbor item.site if item.site?
wiki.site(data.site).get "#{data.slug}.json", (err, remote) ->
if !err
item.type = 'reference'
item.site = data.site
item.slug = data.slug
item.title = remote.title || data.slug
item.text = synopsis remote
syncEditAction()
neighborhood.registerNeighbor item.site if item.site?

addVideo = (video) ->
item.type = 'video'
Expand Down
13 changes: 9 additions & 4 deletions lib/legacy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,17 @@ $ ->
$('.page').each (index, element) ->
refresh.emitTwins $(element)

lineupActivity = require './lineupActivity'
$("<span class=menu> &nbsp; &equiv; &nbsp; </span>")
.css({"cursor":"pointer", "font-size": "120%"})
# $('.editEnable').is(':visible')
$("<span>&nbsp; wiki <span class=editEnable>✔︎</span> &nbsp; </span>")
.css({"cursor":"pointer"})
.appendTo('footer')
.click ->
dialog.open "Lineup Activity", lineupActivity.show()
$('.editEnable').toggle()
$('.page').each ->
$page = $(this)
pageObject = lineup.atKey $page.data('key')
refresh.rebuildPage pageObject, $page.empty()
$('.editEnable').toggle() unless isAuthenticated

target.bind()

Expand Down
44 changes: 0 additions & 44 deletions lib/lineupActivity.coffee

This file was deleted.

20 changes: 11 additions & 9 deletions lib/refresh.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ renderPageIntoPageElement = (pageObject, $page) ->
$paper = $("<div class='paper' />")
$page.append($paper)
[$twins, $header, $story, $journal, $footer] = ['twins', 'header', 'story', 'journal', 'footer'].map (className) ->
$("<div />").addClass(className).appendTo($paper)
$("<div />").addClass(className).appendTo($paper) if className != 'journal' or $('.editEnable').is(':visible')

emitHeader $header, $page, pageObject
emitTimestamp $header, $page, pageObject
Expand All @@ -248,13 +248,14 @@ renderPageIntoPageElement = (pageObject, $page) ->
$story.append $item
plugin.do $item, item, done

pageObject.seqActions (each, done) ->
addToJournal $journal, each.separator if each.separator
addToJournal $journal, each.action
done()
if $('.editEnable').is(':visible')
pageObject.seqActions (each, done) ->
addToJournal $journal, each.separator if each.separator
addToJournal $journal, each.action
done()

emitTwins $page
emitControls $journal
emitControls $journal if $('.editEnable').is(':visible')
emitFooter $footer, pageObject


Expand All @@ -275,9 +276,10 @@ rebuildPage = (pageObject, $page) ->
#STATE -- update url when adding new page, removing others
state.setUrl()

initDragging $page
initMerging $page
initAddButton $page
if $('.editEnable').is(':visible')
initDragging $page
initMerging $page
initAddButton $page
$page

buildPage = (pageObject, $page) ->
Expand Down
24 changes: 12 additions & 12 deletions lib/siteAdapter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ findAdapter = (site) ->
if sitePrefix[site]?
done sitePrefix[site]

testURL = "//#{site}/favicon.png?testing"
testURL = "//#{site}/favicon.png"
this.test testURL, (worked) ->
if worked
sitePrefix[site] = "//#{site}"
done "//#{site}"
else
switch location.protocol
when 'http:'
testURL = "https://#{site}/favicon.png?testing"
testURL = "https://#{site}/favicon.png"
this.test testURL, (worked) ->
if worked
sitePrefix[site] = "https://#{site}"
Expand All @@ -55,7 +55,7 @@ findAdapter = (site) ->
sitePrefix[site] = ""
done ""
when 'https:'
testURL = "/proxy/#{site}/favicon.png?testing"
testURL = "/proxy/#{site}/favicon.png"
this.test testURL, (worked) ->
if worked
sitePrefix[site] = "/proxy/#{site}"
Expand All @@ -71,7 +71,7 @@ findAdapter = (site) ->
done ""

siteAdapter.local = {
flag: -> "/favicon.png?adapted"
flag: -> "/favicon.png"
getURL: (route) -> "/#{route}"
get: (route, done) ->
console.log "wiki.local.get #{route}"
Expand All @@ -89,14 +89,14 @@ siteAdapter.local = {
}

siteAdapter.origin = {
flag: -> "/favicon.png?adapted"
flag: -> "/favicon.png"
getURL: (route) -> "/#{route}"
get: (route, done) ->
console.log "wiki.origin.get #{route}"
$.ajax
type: 'GET'
dataType: 'json'
url: "/#{route}?adapted"
url: "/#{route}"
success: (page) -> done null, page
error: (xhr, type, msg) -> done {msg, xhr}, null
put: (route, data, done) ->
Expand Down Expand Up @@ -148,7 +148,7 @@ siteAdapter.site = (site) ->
tempFlags[site]
else
# we already know how to construct flag url
sitePrefix[site] + "/favicon.png?adapted"
sitePrefix[site] + "/favicon.png"
else if tempFlags[site]?
# we already have a temp. flag
console.log "wiki.site(#{site}).flag - have temp. flag"
Expand All @@ -163,7 +163,7 @@ siteAdapter.site = (site) ->
console.log "Prefix for #{site} is #{prefix}"
# replace temp flags
tempFlag = tempFlags[site]
realFlag = sitePrefix[site] + "/favicon.png?replaceTemp"
realFlag = sitePrefix[site] + "/favicon.png"
# replace temporary flag where it is used as an image
$('img[src="' + tempFlag + '"]').attr('src', realFlag)
# replace temporary flag where its used as a background to fork event in journal
Expand Down Expand Up @@ -208,9 +208,9 @@ siteAdapter.site = (site) ->
if sitePrefix[site]?
if sitePrefix[site] is ""
console.log "#{site} is unreachable"
done {"#{site} is unreachable"}, null
done {msg: "#{site} is unreachable", xhr: {status: 0}}, null
else
url = "#{sitePrefix[site]}/#{route}?adapted"
url = "#{sitePrefix[site]}/#{route}"
$.ajax
type: 'GET'
dataType: 'json'
Expand All @@ -221,9 +221,9 @@ siteAdapter.site = (site) ->
findAdapter(site).prefix (prefix) ->
if prefix is ""
console.log "#{site} is unreachable"
done {"#{site} is unreachable"}, null
done {msg: "#{site} is unreachable", xhr: {status: 0}}, null
else
url = "#{prefix}/#{route}?adapted"
url = "#{prefix}/#{route}"
$.ajax
type: 'GET'
dataType: 'json'
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wiki-client",
"version": "0.8.3",
"version": "0.9.0-6",
"description": "Federated Wiki - Client-side Javascript",
"keywords": [
"wiki",
Expand Down Expand Up @@ -31,13 +31,13 @@
"test": "grunt mochaTest"
},
"devDependencies": {
"coffee-script": "^1.12.2",
"coffee-script": "^1.12.4",
"coffeeify": "^2.1.0",
"expect.js": "^0.3.1",
"grunt": "^1.0.1",
"grunt-browserify": "^5.0.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-uglify": "^2.0.0",
"grunt-contrib-uglify": "^2.2.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-git-authors": "^3.2.0",
"grunt-mocha-test": "^0.13.2",
Expand All @@ -55,6 +55,6 @@
"url": "https://github.com/fedwiki/wiki-client/issues"
},
"engines": {
"node": ">=4.x"
"node": ">=6.x"
}
}
5 changes: 3 additions & 2 deletions views/static.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
<div id='security' class='footer-item'></div>

<span class='searchbox' class='footer-item'>
Search:
<input class='search' name='search' type='text'>
&nbsp;
<input class='search' name='search' type='text' placeholder="Search">
&nbsp;
<span class='pages'></span>
</span>

Expand Down

0 comments on commit c2b608f

Please sign in to comment.