Skip to content

Commit 6719a8c

Browse files
author
Caio Tarifa
committed
Responsive Update! Releasing 0.1.4 \o/
1 parent 828172f commit 6719a8c

File tree

8 files changed

+95
-62
lines changed

8 files changed

+95
-62
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
# Formadmin
22

3-
Modern theme for Active Admin used by Formaweb.
3+
Modern and responsive theme for Active Admin used by Formaweb.
44

55
## Installation
66

77
1. Please make sure that you are using Active Admin from their Github repo:
8-
98
```
109
gem 'activeadmin', github: 'activeadmin/activeadmin'
1110
```
1211

1312
2. Add this gem in your `Gemfile`:
14-
1513
```
1614
gem 'formadmin'
1715
```
1816

1917
3. So, bundle...
20-
2118
```
2219
$ bundle install
2320
```

app/assets/stylesheets/formadmin/layouts/_header.scss

Lines changed: 67 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.header {
1+
#header.header {
22
align-items: center;
33
background-color: rgba($primary-color, 0.95);
44
backdrop-filter: blur(3px);
@@ -146,6 +146,7 @@
146146
text-align: right;
147147
transition: color 250ms;
148148
white-space: nowrap;
149+
width: 100%;
149150

150151
a {
151152
text-decoration: none;
@@ -157,6 +158,15 @@
157158

158159
li {
159160
display: inline;
161+
162+
&:not(#current_user) {
163+
opacity: 0.75;
164+
transition: opacity 250ms;
165+
166+
&:hover {
167+
opacity: 1;
168+
}
169+
}
160170
}
161171
}
162172

@@ -168,17 +178,69 @@
168178
@media #{$largest-phone-screen} {
169179
#tabs,
170180
#utility_nav {
171-
display: none;
172181
left: 0;
173-
position: absolute;
182+
opacity: 0;
183+
position: fixed;
174184
right: 0;
185+
transform: translateY(calc(-100% - 90px));
186+
transition: transform 250ms;
187+
}
188+
189+
#utility_nav {
190+
background-color: $primary-color;
191+
height: 40px;
192+
padding: 11px 0;
193+
text-align: center;
175194
top: 50px;
176195
}
177196

197+
#tabs {
198+
background-color: rgba($primary-color, 0.95);
199+
top: 90px;
200+
201+
li {
202+
display: block;
203+
float: none;
204+
margin: 0;
205+
padding: 5px 15px;
206+
width: 100%;
207+
208+
+ li {
209+
border-top: 1px solid rgba($white, 0.1);
210+
}
211+
}
212+
213+
a {
214+
display: block;
215+
}
216+
}
217+
178218
.site_title {
179219
padding: 0 15px;
180220
}
181221

222+
.header-item ul {
223+
background: transparent;
224+
height: auto;
225+
max-width: 100%;
226+
opacity: 1;
227+
margin-left: 5px;
228+
position: static;
229+
transform: scale(1);
230+
width: 100%;
231+
232+
li {
233+
border: 0 !important;
234+
padding: 0 !important;
235+
236+
a:before {
237+
display: inline;
238+
content: '';
239+
margin-right: 5px;
240+
}
241+
}
242+
}
243+
182244
.menu-button {
183245
display: block;
184246
margin-left: auto;
@@ -190,35 +252,9 @@
190252
#tabs,
191253
#utility_nav {
192254
display: block;
255+
opacity: 1;
256+
transform: translateY(0);
193257
}
194258
}
195-
196-
// display: block;
197-
// .site_title {
198-
// padding: 0 15px;
199-
// }
200-
//
201-
// #tabs,
202-
// #utility_nav {
203-
// display: none;
204-
// left: 0;
205-
// position: absolute;
206-
// top: 50px;
207-
// width: 100%;
208-
// }
209-
//
210-
// .menu-button {
211-
// float: left;
212-
// margin-right: 15px;
213-
// position: relative;
214-
// top: 13px;
215-
// }
216-
//
217-
// .opened-menu & {
218-
// #tabs,
219-
// #utility_nav {
220-
// display: block;
221-
// }
222-
// }
223259
}
224260
}

app/assets/stylesheets/formadmin/layouts/_title-bar.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666

6767
// Medias
6868
@media #{$phone-and-tablet-screen} {
69+
#page_title {
70+
word-break: keep-all;
71+
}
72+
6973
#titlebar_left,
7074
#titlebar_right {
7175
display: block;

app/assets/stylesheets/formadmin/pages/_logged-out.scss

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ body.logged_out {
88
#content_wrapper {
99
margin: 70px auto;
1010
padding: 0;
11-
width: 500px;
11+
max-width: 500px;
12+
width: 100%;
1213
}
1314

1415
h2 {
@@ -42,4 +43,16 @@ body.logged_out {
4243
border-width: 1px;
4344
margin-bottom: 20px;
4445
}
46+
47+
// Medias
48+
@media #{$largest-phone-screen} {
49+
#wrapper {
50+
padding: 15px;
51+
}
52+
53+
#content_wrapper {
54+
margin: 0 auto;
55+
max-width: 450px;
56+
}
57+
}
4558
}

lib/formadmin.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
require 'formadmin/version'
2+
require 'formadmin/engine'
3+
require 'formadmin/active_admin/application'
24
require 'formadmin/active_admin/views/header'
3-
require 'formadmin/active_admin/views/pages/base'
4-
5-
module Formadmin
6-
module Rails
7-
class Engine < ::Rails::Engine
8-
end
9-
end
10-
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module ActiveAdmin
2+
responsive_viewport = { viewport: 'width=device-width, initial-scale=1' }
3+
4+
ActiveAdmin.application.meta_tags.merge! responsive_viewport
5+
ActiveAdmin.application.meta_tags_for_logged_out_pages.merge! responsive_viewport
6+
end

lib/formadmin/active_admin/views/header.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def build namespace, menu
99
end
1010

1111
def build_responsive_menu
12-
button '<i></i>'.html_safe, type: 'button', class: 'menu-button'
12+
button '<i></i>'.html_safe, type: 'button', class: 'menu-button', onclick: 'document.body.classList.toggle("opened-menu")'
1313
end
1414
end
1515
end

lib/formadmin/active_admin/views/pages/base.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)