Skip to content

Commit

Permalink
Merge pull request #3 from publiclab/master
Browse files Browse the repository at this point in the history
sync 3
  • Loading branch information
sssash18 authored Jan 19, 2020
2 parents 1a1da62 + 74031d9 commit 8f0a21e
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 62 deletions.
52 changes: 52 additions & 0 deletions app/assets/stylesheets/notes.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#notes .card {
background-color: #fff;
border: 1px solid;
border-color: #D3D3D3;
border-radius: 6px;
margin:1em 0em 1em 0em;
padding: 0px !important;
}
#notes .card-body {
margin-right: 1em;
margin-left: 1em;
padding: 0.8em;
text-align: left;
}

#notes .btn {
font-size: 15px;
}

#notes .buttons {
text-align: center;
}

#notes .imgg {
background: #aaa;
display: flex;
align-items: center;
}

#notes .note-not {
margin-left:auto;
margin-right: auto;
color: #fff;
}

#notes .ellipsis {
cursor: pointer;
}

#notes .dropdown-menu li a{
display: inline-block;
padding-bottom: 5px;
padding-left: 14px;
font-size: 13px;
}

#notes .bottom-right {
position: absolute;
bottom: 10px;
right: 16px;
text-decoration: underline;
}
3 changes: 2 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module Frequency

acts_as_authentic do |c|
c.crypto_provider = Authlogic::CryptoProviders::Sha512
c.validates_format_of_login_field_options = { with: Authlogic::Regex::LOGIN, message: I18n.t('error_messages.login_invalid', default: "can only consist of alphabets, numbers, underscore '_', and hyphen '-'.") }
end

has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' },
Expand Down Expand Up @@ -149,7 +150,7 @@ def is_coauthor?(node)
def tags(limit = 10)
Tag.where('name in (?)', tagnames).limit(limit)
end

def normal_tags
tags.select{ |tag| ! tag.name.include?(':') }
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/like/_like.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<i class="ml-1 ff fa fa-lock"></i>
</a>
<% else %>
<a class="btn-circle btn btn-outline-secondary" href='<%= node.edit_path %>?t=<%= Time.now.to_i %>'>
<a class="btn-circle btn btn-outline-secondary" id="edit-btn" href='<%= node.edit_path %>?t=<%= Time.now.to_i %>'>
<i class='ml-1 ff fa fa-pencil'></i>
</a>
<% end %>
Expand Down
56 changes: 0 additions & 56 deletions app/views/notes/_notes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,3 @@
</div>
<%= will_paginate notes, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated || (unpaginated ||= false) %>

<style>
/* TODO: Let's move this to a real stylesheet */
#notes .card {
background-color: #fff;
border: 1px solid;
border-color: #D3D3D3;
border-radius: 6px;
margin:1em 0em 1em 0em;
padding: 0px !important;
}
#notes .card-body {
margin-right: 1em;
margin-left: 1em;
padding: 0.8em;
text-align: left;
}

#notes .btn {
font-size: 15px;
}

#notes .buttons {
text-align: center;
}

#notes .imgg {
background: #aaa;
display: flex;
align-items: center;
}

#notes .note-not {
margin-left:auto;
margin-right: auto;
color: #fff;
}

#notes .ellipsis {
cursor: pointer;
}

#notes .dropdown-menu li a{
display: inline-block;
padding-bottom: 5px;
padding-left: 14px;
font-size: 13px;
}

#notes .bottom-right {
position: absolute;
bottom: 10px;
right: 16px;
text-decoration: underline;
}

</style>
8 changes: 4 additions & 4 deletions test/integration/signup_flow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def setup
}

assert response.body.include? '2 errors prohibited this user from being saved'
assert response.body.include? 'Username should use only letters, numbers, spaces, and .-_@+ please.'
assert response.body.include? `Username can only consist of alphabets, numbers, underscore '_', and hyphen '-'.`
assert response.body.include? 'Username is too short (minimum is 3 characters)'
end

Expand Down Expand Up @@ -104,9 +104,9 @@ def setup
private

def test_username_regex(name)
post '/register', params: {
post '/register', params: {
user: {
username: name,
username: name,
email: @new_user[:email],
password: @new_user[:password],
password_confirmation: @new_user[:password],
Expand All @@ -115,6 +115,6 @@ def test_username_regex(name)
}

assert response.body.include? '1 error prohibited this user from being saved'
assert response.body.include? 'Username should use only letters, numbers, spaces, and .-_@+ please.'
assert response.body.include? `Username can only consist of alphabets, numbers, underscore '_', and hyphen '-'.`
end
end
43 changes: 43 additions & 0 deletions test/system/post_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,48 @@ def assert_page_does_not_reload(message = "page should not reload")
# Make sure that image has been uploaded
page.assert_selector('#preview img', count: 1)
end

test "changing and reverting versions works correctly for wiki" do
wiki = nodes(:wiki_page)

visit wiki.path
# save text of wiki before edit
old_wiki_content = find("#content").text

find("a#edit-btn").click()
find("#text-input").set("wiki text")
find("a#publish").click()

# view wiki
current_wiki_content = find("#content").text
# make sure edits worked and text is different
assert current_wiki_content != old_wiki_content

find("a[data-original-title='View all revisions for this page.']").click()
accept_confirm "Are you sure?" do
# revert to previous version of wiki
all("a", text: "Revert")[1].click()
end
visit wiki.path

# check old wiki content is the same as current content after revert
assert old_wiki_content == find("#content").text
end

test "revision diff is displayed when comparing versions" do
wiki = nodes(:wiki_page)

visit wiki.path

find("a#edit-btn").click()
find("#text-input").native.send_keys(:enter, :enter, "wiki text")
find("a#publish").click()

find("a[data-original-title='View all revisions for this page.']").click()

# verify additions are displayed as green `<ins>` tags
page.assert_selector("ins", text: "<p>wiki")
page.assert_selector("ins", text: "text</p>")
end

end

0 comments on commit 8f0a21e

Please sign in to comment.