Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
crabgrass
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
45
Issues
45
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
riseuplabs
crabgrass
Commits
ed0c39e9
Commit
ed0c39e9
authored
Jul 18, 2019
by
dgt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP css styles for archived content
parent
314c0f5d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
35 deletions
+123
-35
app/assets/stylesheets/archive.css
app/assets/stylesheets/archive.css
+60
-0
app/models/group/archive/pages_generator.rb
app/models/group/archive/pages_generator.rb
+14
-7
app/models/group/archive/path.rb
app/models/group/archive/path.rb
+8
-0
app/models/group/archive/singlepage_generator.rb
app/models/group/archive/singlepage_generator.rb
+7
-2
app/views/group/archives/page.html.haml
app/views/group/archives/page.html.haml
+33
-26
config/directories.rb
config/directories.rb
+1
-0
No files found.
app/assets/stylesheets/archive.css
0 → 100644
View file @
ed0c39e9
body
{
font-family
:
Verdana
,
"Liberation Sans"
,
Arial
,
sans-serif
;
font-size
:
13px
;
line-height
:
1.428571429
;
color
:
#000
;
max-width
:
1200px
;
padding-right
:
40px
;
padding-left
:
40px
;
}
h1
{
font-size
:
30px
;
color
:
#666666
;
border-bottom
:
2px
dotted
#999999
;
margin
:
0.67em
0
;
}
h2
{
font-size
:
18px
;
border-bottom
:
1px
dashed
#cccccc
;
margin
:
0.83em
0
;
}
a
{
color
:
#2a5183
;
text-decoration
:
none
;
}
a
.anchor
,
a
.shy
{
display
:
none
;}
a
:hover
{
color
:
#172d49
;
text-decoration
:
underline
;
}
ul
,
ol
{
padding-left
:
2.5em
;
margin-left
:
0.5em
;
margin-top
:
0
;
margin-bottom
:
9px
;
}
code
{
font-family
:
Menlo
,
Monaco
,
Consolas
,
"Courier New"
,
monospace
;
display
:
block
;
border
:
solid
1px
#ffe8a9
;
background-color
:
#fff6dd
;
}
.title_box
{
margin-bottom
:
15px
;
background-color
:
#eee
;
border
:
1px
solid
#ddd
;
border-radius
:
4px
;
}
.backlink
{
margin-right
:
10px
;
float
:
'right'
;
}
app/models/group/archive/pages_generator.rb
View file @
ed0c39e9
...
...
@@ -21,6 +21,7 @@ class Group::Archive::PagesGenerator
def
prepare_files
create_group_dirs
add_css_file
add_group_content
@group
.
committees
.
each
do
|
committee
|
add_group_content
(
committee
)
...
...
@@ -80,12 +81,16 @@ class Group::Archive::PagesGenerator
haml_engine
=
Haml
::
Engine
.
new
(
template
)
if
page
.
type
==
'WikiPage'
wiki_html
=
nil
||
page
.
wiki
.
body_html
.
gsub
(
'/asset'
,
'asset'
)
haml_engine
.
to_html
Object
.
new
,
wiki_html:
fix_links
(
page
.
owner
.
name
,
wiki_html
),
group:
page
.
owner
,
page:
page
haml_engine
.
to_html
Object
.
new
,
wiki_html:
fix_links
(
page
.
owner
.
name
,
wiki_html
),
group:
page
.
owner
,
page:
page
,
css_file:
css_file
(
page
.
owner
)
else
haml_engine
.
to_html
Object
.
new
,
group:
page
.
owner
,
page:
page
,
wiki_html:
nil
haml_engine
.
to_html
Object
.
new
,
group:
page
.
owner
,
page:
page
,
wiki_html:
nil
,
css_file:
css_file
(
page
.
owner
)
end
end
def
add_css_file
FileUtils
.
cp
File
.
join
(
STYLES_DIR
,
'archive.css'
),
File
.
join
(
tmp_dir
,
@group
.
name
)
end
def
add_avatar
(
group
)
FileUtils
.
cp
avatar_url_for
(
group
),
File
.
join
(
asset_dir
(
group
),
"
#{
group
.
name
}
.jpg"
)
rescue
Errno
::
ENOENT
=>
error
...
...
@@ -133,31 +138,33 @@ class Group::Archive::PagesGenerator
def
table_of_content
(
group
,
pages
)
public_wiki
=
group
.
public_wiki
private_wiki
=
group
.
private_wiki
html
=
"<html><head></head><meta charset='UTF-8'><body><table>"
html
<<
"<img src='assets/
#{
group
.
name
}
.jpg')} alt='avatar' height='64' width='64'>"
html
=
"<html><head><meta charset='UTF-8'>"
html
<<
"<link href=
#{
css_file
(
group
)
}
rel='stylesheet' type='text/css'></head>"
html
<<
"<body><img src='assets/
#{
group
.
name
}
.jpg') alt='avatar' height='64' width='64'>"
html
<<
"<h1>Archive of
#{
group
.
display_name
}
</h1>"
html
<<
"<p>Created on
#{
Time
.
now
.
getutc
}
</p>"
html
<<
"<h3>
#{
:private_wiki
.
t
}
</h3>
#{
private_wiki
.
body_html
}
"
if
private_wiki
&
.
has_content?
html
<<
"<h3>
#{
:public_wiki
.
t
}
</h3>
#{
public_wiki
.
body_html
}
"
if
public_wiki
&
.
has_content?
html
<<
"<table>"
pages
.
each
do
|
page
|
html
<<
"<tr><td><a href=./
#{
page
.
name_url
}
.html>
#{
page
.
title
}
</a></td><td>
#{
:updated_by
.
t
}
#{
page
.
updated_by
.
display_name
}
</td><td>
#{
page
.
updated_at
}
</td></tr>"
end
html
<<
'</table>'
if
group
.
council
html
<<
"<h
3>
#{
:council
.
t
}
</h3
>"
html
<<
"<h
2>
#{
:council
.
t
}
</h2
>"
unless
group_pages
(
group
.
council
).
empty?
html
<<
"<p><a href=./
#{
group
.
council
.
name
}
/index.html>
#{
group
.
council
.
display_name
}
</a></p>"
end
end
if
group
.
real_committees
.
any?
html
<<
"<h
3>
#{
:committees
.
t
}
</h3
>"
html
<<
"<h
2>
#{
:committees
.
t
}
</h2
>"
group
.
children
.
each
do
|
committee
|
unless
group_pages
(
committee
).
empty?
html
<<
"<p><a href=./
#{
committee
.
name
}
/index.html>
#{
committee
.
display_name
}
</a></p>"
end
end
end
html
<<
'</html>'
html
<<
'</
body></
html>'
end
private
...
...
app/models/group/archive/path.rb
View file @
ed0c39e9
...
...
@@ -28,6 +28,14 @@ module Group::Archive::Path
"
#{
@group
.
name
}
.zip"
end
def
css_file
(
group
)
if
group
.
committee?
# FIXME: will not work for councils (if exported as children)
'../archive.css'
else
'archive.css'
end
end
def
avatar_url_for
(
group
)
format
(
"
#{
APP_ROOT
}
/public/avatars/%s/large.jpg"
,
group
.
avatar_id
||
0
)
end
...
...
app/models/group/archive/singlepage_generator.rb
View file @
ed0c39e9
...
...
@@ -23,6 +23,7 @@ class Group::Archive::SinglepageGenerator
def
prepare_files
create_asset_dir
# differs from pages_generator
add_css_file
add_group_content
@group
.
committees
.
each
do
|
committee
|
add_group_content
(
committee
)
...
...
@@ -81,12 +82,16 @@ class Group::Archive::SinglepageGenerator
haml_engine
=
Haml
::
Engine
.
new
(
template
)
if
page
.
type
==
'WikiPage'
wiki_html
=
nil
||
page
.
wiki
.
body_html
.
gsub
(
'/asset'
,
'asset'
)
haml_engine
.
to_html
Object
.
new
,
wiki_html:
fix_links
(
page
.
owner
.
name
,
wiki_html
),
group:
page
.
owner
,
page:
page
haml_engine
.
to_html
Object
.
new
,
wiki_html:
fix_links
(
page
.
owner
.
name
,
wiki_html
),
group:
page
.
owner
,
page:
page
,
css_file:
css_file
(
page
.
owner
)
else
haml_engine
.
to_html
Object
.
new
,
group:
page
.
owner
,
page:
page
,
wiki_html:
nil
haml_engine
.
to_html
Object
.
new
,
group:
page
.
owner
,
page:
page
,
wiki_html:
nil
,
css_file:
css_file
(
page
.
owner
)
end
end
def
add_css_file
FileUtils
.
cp
File
.
join
(
STYLES_DIR
,
'archive.css'
),
tmp_dir
end
def
add_avatar
(
group
)
FileUtils
.
cp
avatar_url_for
(
group
),
File
.
join
(
tmp_dir
,
'assets'
,
"
#{
group
.
name
}
.jpg"
)
rescue
Errno
::
ENOENT
=>
error
...
...
app/views/group/archives/page.html.haml
View file @
ed0c39e9
%meta
(
charset=
"UTF-8"
)
%h1
{
id:
page
.
id
}
#{
page
.
title
}
%small
.summary
=
h
page
.
summary
-
if
wiki_html
.
present?
=
wiki_html
-
if
page
.
posts
.
present?
%div
.comments
%h2
=
h
(
:comments
.
t
)
-
page
.
posts
.
each
do
|
post
|
%h4
=
"
#{
post
.
user
.
login
}
on
#{
post
.
updated_at
}
"
.negativespace
=
post
.
body_html
-
if
page
.
assets
.
present?
%div
.attachments
%h2
=
h
(
:attachments
.
t
)
-
page
.
assets
.
each
do
|
asset
|
-
image_url
=
File
.
join
(
'assets'
,
asset
.
id
.
to_s
,
asset
.
filename
.
gsub
(
' '
,
'+'
))
%li
%a
{
:href
=>
image_url
,
:title
=>
asset
.
filename
}
#{
asset
.
filename
}
-
if
page
.
data
.
is_a?
Asset
%div
.attachments
%h2
=
h
(
:file
.
t
)
-
image_url
=
File
.
join
(
'assets'
,
page
.
data
.
id
.
to_s
,
page
.
data
.
filename
.
gsub
(
' '
,
'+'
))
%li
%a
{
:href
=>
image_url
,
:title
=>
page
.
data
.
filename
}
#{
page
.
data
.
filename
}
%html
%head
%meta
{
charset:
'utf8'
}
%title
=
page
.
title
%link
{
:rel
=>
:stylesheet
,
:type
=>
:"text/css"
,
:href
=>
css_file
}
%body
=
# link_to 'index.html', :back.t, class: 'backlink'
%div
.title_box
%h1
{
id:
page
.
id
}
#{
page
.
title
}
%small
.summary
=
h
page
.
summary
-
if
wiki_html
.
present?
=
wiki_html
-
if
page
.
posts
.
present?
%div
.comments
%h2
=
h
(
:comments
.
t
)
-
page
.
posts
.
each
do
|
post
|
%h4
=
"
#{
post
.
user
.
login
}
on
#{
post
.
updated_at
}
"
.negativespace
=
post
.
body_html
-
if
page
.
assets
.
present?
%div
.attachments
%h2
=
h
(
:attachments
.
t
)
-
page
.
assets
.
each
do
|
asset
|
-
image_url
=
File
.
join
(
'assets'
,
asset
.
id
.
to_s
,
asset
.
filename
.
gsub
(
' '
,
'+'
))
%li
%a
{
:href
=>
image_url
,
:title
=>
asset
.
filename
}
#{
asset
.
filename
}
-
if
page
.
data
.
is_a?
Asset
%div
.attachments
%h2
=
h
(
:file
.
t
)
-
image_url
=
File
.
join
(
'assets'
,
page
.
data
.
id
.
to_s
,
page
.
data
.
filename
.
gsub
(
' '
,
'+'
))
%li
%a
{
:href
=>
image_url
,
:title
=>
page
.
data
.
filename
}
#{
page
.
data
.
filename
}
config/directories.rb
View file @
ed0c39e9
...
...
@@ -34,6 +34,7 @@ dirs << STATIC_JS_SRC_DIR = APP_ROOT + 'app/assets/javascripts'
dirs
<<
AS_NEEDED_JS_SRC_DIR
=
APP_ROOT
+
'app/assets/javascripts/as_needed'
dirs
<<
STATIC_JS_DEST_DIR
=
APP_ROOT
+
'public/static'
dirs
<<
AS_NEEDED_JS_DEST_DIR
=
APP_ROOT
+
'public/static/as_needed'
dirs
<<
STYLES_DIR
=
APP_ROOT
+
'app/assets/stylesheets'
# TODO: check if there is a Rails constant for this.
# assets
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment