Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
ce08f919
Commit
ce08f919
authored
Feb 13, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add link to share via twitter to "created project" event.
parent
9b917b4a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
57 additions
and
5 deletions
+57
-5
app/assets/stylesheets/sections/events.scss
app/assets/stylesheets/sections/events.scss
+4
-0
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+1
-0
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+4
-0
app/models/application_setting.rb
app/models/application_setting.rb
+2
-0
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+5
-0
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+4
-2
app/views/events/event/_created_project.html.haml
app/views/events/event/_created_project.html.haml
+27
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb
...43_add_twitter_sharing_enabled_to_application_settings.rb
+5
-0
db/schema.rb
db/schema.rb
+4
-3
No files found.
app/assets/stylesheets/sections/events.scss
View file @
ce08f919
...
...
@@ -64,6 +64,10 @@
.md
{
font-size
:
13px
;
iframe
.twitter-share-button
{
vertical-align
:
bottom
;
}
}
pre
{
...
...
app/controllers/admin/application_settings_controller.rb
View file @
ce08f919
...
...
@@ -26,6 +26,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:signup_enabled
,
:signin_enabled
,
:gravatar_enabled
,
:twitter_sharing_enabled
,
:sign_in_text
,
:home_page_url
)
...
...
app/helpers/application_settings_helper.rb
View file @
ce08f919
...
...
@@ -3,6 +3,10 @@ module ApplicationSettingsHelper
current_application_settings
.
gravatar_enabled?
end
def
twitter_sharing_enabled?
current_application_settings
.
twitter_sharing_enabled?
end
def
signup_enabled?
current_application_settings
.
signup_enabled?
end
...
...
app/models/application_setting.rb
View file @
ce08f919
...
...
@@ -8,6 +8,7 @@
# signup_enabled :boolean
# signin_enabled :boolean
# gravatar_enabled :boolean
# twitter_sharing_enabled :boolean
# sign_in_text :text
# created_at :datetime
# updated_at :datetime
...
...
@@ -30,6 +31,7 @@ class ApplicationSetting < ActiveRecord::Base
default_branch_protection:
Settings
.
gitlab
[
'default_branch_protection'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
signin_enabled:
Settings
.
gitlab
[
'signin_enabled'
],
twitter_sharing_enabled:
Settings
.
gitlab
[
'twitter_sharing_enabled'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
sign_in_text:
Settings
.
extra
[
'sign_in_text'
],
)
...
...
app/views/admin/application_settings/_form.html.haml
View file @
ce08f919
...
...
@@ -19,6 +19,11 @@
=
f
.
label
:gravatar_enabled
,
class:
'control-label'
.col-sm-10
=
f
.
check_box
:gravatar_enabled
,
class:
'checkbox'
.form-group
=
f
.
label
:twitter_sharing_enabled
,
"Twitter enabled"
,
class:
'control-label'
.col-sm-10
=
f
.
check_box
:twitter_sharing_enabled
,
class:
'checkbox'
%span
.help-block
Show users button to share their newly created public or internal projects on twitter
%fieldset
%legend
Misc
.form-group
...
...
app/views/events/_event.html.haml
View file @
ce08f919
...
...
@@ -3,12 +3,14 @@
.event-item-timestamp
#{
time_ago_with_tooltip
(
event
.
created_at
)
}
=
cache
event
do
=
cache
[
event
,
current_user
]
do
=
image_tag
avatar_icon
(
event
.
author_email
,
24
),
class:
"avatar s24"
,
alt
:''
-
if
event
.
push?
=
render
"events/event/push"
,
event:
event
-
elsif
event
.
note
?
-
elsif
event
.
commented
?
=
render
"events/event/note"
,
event:
event
-
elsif
event
.
created_project?
=
render
"events/event/created_project"
,
event:
event
-
else
=
render
"events/event/common"
,
event:
event
\ No newline at end of file
app/views/events/event/_created_project.html.haml
0 → 100644
View file @
ce08f919
.event-title
%span
.author_name
=
link_to_author
event
%span
.event_label
{
class:
event
.
action_name
}
=
event_action_name
(
event
)
-
if
event
.
project
=
link_to_project
event
.
project
-
else
=
event
.
project_name
-
if
current_user
==
event
.
author
&&
!
event
.
project
.
private?
&&
twitter_sharing_enabled?
.event-body
.event-note
.md
%p
Congratulations! Why not share your accomplishment with the world?
%a
.twitter-share-button
{
|
href:
"https://twitter.com/share"
,
|
class:
"twitter-share-button"
,
|
"data-url"
=>
event
.
project
.
web_url
,
|
"data-text"
=>
"I just created a new project in GitLab! GitLab is version control on your server, like GitHub but better."
,
|
"data-size"
=>
"medium"
,
|
"data-related"
=>
"gitlab"
,
|
"data-count"
=>
"none"
}
Tweet
<script>
!
function
(
d
,
s
,
id
){
var
js
,
fjs
=
d
.
getElementsByTagName
(
s
)[
0
],
p
=
/^http:/
.
test
(
d
.
location
)?
'
http
'
:
'
https
'
;
if
(
!
d
.
getElementById
(
id
)){
js
=
d
.
createElement
(
s
);
js
.
id
=
id
;
js
.
src
=
p
+
'
://platform.twitter.com/widgets.js
'
;
fjs
.
parentNode
.
insertBefore
(
js
,
fjs
);}}(
document
,
'
script
'
,
'
twitter-wjs
'
);
</script>
\ No newline at end of file
config/initializers/1_settings.rb
View file @
ce08f919
...
...
@@ -112,6 +112,7 @@ end
Settings
.
gitlab
[
'time_zone'
]
||=
nil
Settings
.
gitlab
[
'signup_enabled'
]
||=
true
if
Settings
.
gitlab
[
'signup_enabled'
].
nil?
Settings
.
gitlab
[
'signin_enabled'
]
||=
true
if
Settings
.
gitlab
[
'signin_enabled'
].
nil?
Settings
.
gitlab
[
'twitter_sharing_enabled'
]
||=
true
if
Settings
.
gitlab
[
'twitter_sharing_enabled'
].
nil?
Settings
.
gitlab
[
'restricted_visibility_levels'
]
=
Settings
.
send
(
:verify_constant_array
,
Gitlab
::
VisibilityLevel
,
Settings
.
gitlab
[
'restricted_visibility_levels'
],
[])
Settings
.
gitlab
[
'username_changing_enabled'
]
=
true
if
Settings
.
gitlab
[
'username_changing_enabled'
].
nil?
Settings
.
gitlab
[
'issue_closing_pattern'
]
=
'((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?|[Rr]esolv(?:e[sd]?|ing)) +(?:(?:issues? +)?#\d+(?:(?:, *| +and +)?))+)'
if
Settings
.
gitlab
[
'issue_closing_pattern'
].
nil?
...
...
db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb
0 → 100644
View file @
ce08f919
class
AddTwitterSharingEnabledToApplicationSettings
<
ActiveRecord
::
Migration
def
change
add_column
:application_settings
,
:twitter_sharing_enabled
,
:boolean
,
default:
true
end
end
db/schema.rb
View file @
ce08f919
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2015021
1174341
)
do
ActiveRecord
::
Schema
.
define
(
version:
2015021
3104043
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -26,6 +26,7 @@ ActiveRecord::Schema.define(version: 20150211174341) do
t
.
datetime
"updated_at"
t
.
string
"home_page_url"
t
.
integer
"default_branch_protection"
,
default:
2
t
.
boolean
"twitter_sharing_enabled"
,
default:
true
end
create_table
"broadcast_messages"
,
force:
true
do
|
t
|
...
...
@@ -333,10 +334,10 @@ ActiveRecord::Schema.define(version: 20150211174341) do
t
.
string
"import_url"
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
string
"avatar"
t
.
string
"import_status"
t
.
float
"repository_size"
,
default:
0.0
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
string
"avatar"
t
.
string
"import_type"
t
.
string
"import_source"
end
...
...
@@ -440,6 +441,7 @@ ActiveRecord::Schema.define(version: 20150211174341) do
t
.
integer
"notification_level"
,
default:
1
,
null:
false
t
.
datetime
"password_expires_at"
t
.
integer
"created_by_id"
t
.
datetime
"last_credential_check_at"
t
.
string
"avatar"
t
.
string
"confirmation_token"
t
.
datetime
"confirmed_at"
...
...
@@ -447,7 +449,6 @@ ActiveRecord::Schema.define(version: 20150211174341) do
t
.
string
"unconfirmed_email"
t
.
boolean
"hide_no_ssh_key"
,
default:
false
t
.
string
"website_url"
,
default:
""
,
null:
false
t
.
datetime
"last_credential_check_at"
t
.
string
"github_access_token"
t
.
string
"gitlab_access_token"
t
.
string
"notification_email"
...
...
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