Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
80eba16a
Commit
80eba16a
authored
Jan 01, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
header search hint
parent
9dc4cef6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
2 deletions
+73
-2
app/helpers/style_helper.rb
+30
-0
app/views/layouts/application.html.erb
+2
-0
app/views/partials/_app_header.html.erb
+41
-2
No files found.
app/helpers/style_helper.rb
0 → 100644
View file @
80eba16a
module
StyleHelper
## Store style
# Usage:
# <% style do %>
# div {
# color: red;
# }
# <% end %>
def
style
(
&
block
)
content_for
(
content_key
,
capture
(
&
block
))
end
## Render all style
def
render_style
return
if
content_for
(
content_key
).
nil?
html_buf
=
'<style type="text/css">'
html_buf
<<
content_for
(
content_key
)
html_buf
<<
'</style>'
html_buf
.
html_safe
end
private
# Use for `content_for`
def
content_key
:style_addon
end
end
app/views/layouts/application.html.erb
View file @
80eba16a
...
...
@@ -9,6 +9,8 @@
<!-- Optional theme -->
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css"
>
<%=
render_style
%>
<%=
csrf_meta_tags
%>
</head>
<body
class=
"
<%=
params
[
:controller
]
%>
-
<%=
params
[
:action
]
%>
"
>
...
...
app/views/partials/_app_header.html.erb
View file @
80eba16a
...
...
@@ -25,8 +25,8 @@
</div>
</form>
<p
class=
"navbar-text"
>
<a
href=
"#"
><span
class=
"glyphicon glyphicon-question-sign"
></span></a>
<p
class=
"navbar-text"
id=
"header-search-hint"
>
<a
href=
"#"
><span
class=
"glyphicon glyphicon-question-sign"
data-toggle=
"modal"
data-target=
"#header-search-description"
></span></a>
</p>
<%=
form_tag
(
destroy_user_session_path
,
:method
=>
:delete
,
class:
'navbar-form navbar-right'
)
do
%>
...
...
@@ -45,3 +45,42 @@
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Modal #header-search-description -->
<div
class=
"modal fade"
id=
"header-search-description"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
Search command
</h4>
</div>
<div
class=
"modal-body"
>
<dl
class=
"dl-horizontal"
>
<dt>
Search by title
</dt>
<dd><pre><a
href=
"
<%=
posts_path
(
q:
'title:ruby'
)
%>
"
>
title:ruby
</a></pre></dd>
<dt>
Search by id
</dt>
<dd><pre><a
href=
"
<%=
posts_path
(
q:
'id:123'
)
%>
"
>
id:123
</a></pre></dd>
<dt>
Search by body
</dt>
<dd><pre><a
href=
"
<%=
posts_path
(
q:
'body:ruby'
)
%>
"
>
body:ruby
</a></pre></dd>
<dt>
Search by author
</dt>
<dd><pre><a
href=
"
<%=
posts_path
(
q:
'@taro'
)
%>
"
>
@taro
</a></pre></dd>
<dt>
Search by tag
</dt>
<dd><pre><a
href=
"
<%=
posts_path
(
q:
'#ruby'
)
%>
"
>
#ruby
</a></pre></dd>
<dt>
Search by date
</dt>
<dd><pre><a
href=
"
<%=
posts_path
(
q:
'date:2013-12-16'
)
%>
"
>
date:2013-12-16
</a></pre></dd>
<dt>
Search by title or body
</dt>
<dd><pre><a
href=
"
<%=
posts_path
(
q:
'ruby'
)
%>
"
>
ruby
</a></pre></dd>
</dl>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Close
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<%
style
do
%>
#header-search-hint{
margin-left: 0;
}
<%
end
%>
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