Skip to content

Commit f8eddae

Browse files
committed
Merge branch 'release/1.0.2'
2 parents 43722b6 + dbd2ba4 commit f8eddae

File tree

13 files changed

+319
-37
lines changed

13 files changed

+319
-37
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# v1.0.2
2+
## 02/18/2017
3+
4+
1. [](#new)
5+
* It is now possible to change the committer name. You can choose between Git User, GitSync Committer Name, Grav User Name, Grav User Fullname (#14).
6+
2. [](#improved)
7+
* Added more documentation and description about the support of 2FA and Access Tokens (#16, #19, thanks @OleVik)
8+
* Added 4th Generic Git choice in the wizard for self-hosted and custom git services (Gogs/Gitea) (#7 - #22 - thanks @erlepereira)
9+
1. [](#bugfix)
10+
* Fixed issue preventing the custom Git Binary Path from getting used (#15)
11+
* Fixed issue with Webhook auto-generated URL where it would display double slashes in case of root domain (#15)
12+
* Fixed issue with the modal not properly restoring the tutorial steps of the active selected service
13+
114
# v1.0.1
215
## 01/29/2017
316

app/wizard/index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import $ from 'jquery';
66

77
const WIZARD = $('[data-remodal-id="wizard"]');
88
const RESET_LOCAL = $('[data-remodal-id="reset-local"]');
9-
const SERVICES = { 'github': 'github.com', 'bitbucket': 'bitbucket.org', 'gitlab': 'gitlab.com' };
9+
const SERVICES = { 'github': 'github.com', 'bitbucket': 'bitbucket.org', 'gitlab': 'gitlab.com', 'allothers': 'allothers.repo' };
1010
const TEMPLATES = {
1111
REPO_URL: 'https://{placeholder}/getgrav/grav.git'
1212
};
@@ -173,6 +173,10 @@ $(document).on('keyup', '[data-gitsync-uribase] [name="gitsync[webhook]"]', (eve
173173

174174
$(document).on('change', '[name="gitsync[repository]"]', (event) => {
175175
const target = $(event.target);
176+
if (!target.is(':checked')) {
177+
return;
178+
}
179+
176180
SERVICE = target.val();
177181

178182
Object.keys(SERVICES).forEach((service) => {
@@ -186,6 +190,18 @@ $(document).on('change', '[name="gitsync[repository]"]', (event) => {
186190

187191
});
188192

193+
$(document).on('click', '[data-access-tokens-details]', (event) => {
194+
const button = $(event.currentTarget);
195+
const panel = button.closest('.access-tokens').find('.access-tokens-details');
196+
197+
panel.slideToggle(250, () => {
198+
const isVisible = panel.is(':visible');
199+
const icon = button.find('.fa');
200+
201+
icon.removeClass('fa-chevron-down fa-chevron-up').addClass(`fa-chevron-${isVisible ? 'up' : 'down'}`);
202+
});
203+
});
204+
189205
$(document).ready(() => {
190206
STEPS = WIZARD.find('[class^="step-"]').length - 1;
191207
WIZARD.wrapInner('<form></form>');

blueprints.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Git Sync
2-
version: 1.0.1
2+
version: 1.0.2
33
description: Allows to synchronize portions of Grav with Git Repositories (GitHub, BitBucket, GitLab)
44
icon: git
55
author:
@@ -51,8 +51,9 @@ form:
5151
placeholder: Username, not email
5252
password:
5353
type: enc-password
54-
label: Git Password
55-
placeholder: Your Git Password
54+
label: Git Password or Token
55+
placeholder: Your Git Password or Token
56+
description: Enter your password or token to encrypt and securely store it, then save the settings. It will not show up here for security reasons.
5657
webhook:
5758
type: text
5859
label: Repository Web Hook
@@ -77,6 +78,15 @@ form:
7778
default: master
7879
label: Remote Branch
7980
placeholder: master
81+
git.author:
82+
type: select
83+
default: gituser
84+
label: Commits Author
85+
options:
86+
gituser: Use Git User Name
87+
gitsync: Use GitSync Committer Name
88+
gravuser: Use Grav User Name
89+
gravfull: Use Grav User Full Name
8090
git.name:
8191
type: text
8292
default: GitSync

classes/GitSync.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,30 @@ public function add()
161161

162162
public function commit($message = '(Grav GitSync) Automatic Commit')
163163
{
164-
$author = $this->user . ' <' . $this->getConfig('git', null)['email'] . '>';
164+
$authorType = $this->getConfig('git', null)['author'];
165+
if (defined('GRAV_CLI') && in_array($authorType, ['gravuser', 'gravfull'])) {
166+
$authorType = 'gituser';
167+
}
168+
169+
switch ($authorType) {
170+
case 'gitsync':
171+
$user = $this->getConfig('git', null)['name'];
172+
break;
173+
case 'gravuser':
174+
$user = $this->grav['session']->user->username;
175+
break;
176+
case 'gravfull':
177+
$user = $this->grav['session']->user->fullname;
178+
break;
179+
case 'gituser':
180+
default:
181+
$user = $this->user;
182+
break;
183+
}
184+
185+
$author = $user . ' <' . $this->getConfig('git', null)['email'] . '>';
165186
$author = '--author="' . $author . '"';
166-
$message .= ' from ' . $this->user;
187+
$message .= ' from ' . $user;
167188
$this->add();
168189
return $this->execute("commit " . $author . " -m " . escapeshellarg($message));
169190
}
@@ -278,7 +299,7 @@ public function execute($command)
278299

279300
public function getGitConfig($type, $value)
280301
{
281-
return !$value && isset($this->config['git']) ? $this->config['git'][$type] : $value;
302+
return isset($this->config['git']) && isset($this->config['git'][$type]) ? $this->config['git'][$type] : $value;
282303
}
283304

284305
public function getRemote($type, $value)

css-compiled/git-sync.css

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

git-sync.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ public function onTwigSiteVariables()
156156
$this->grav['assets']->addCss('plugin://git-sync/css-compiled/git-sync.css');
157157
$this->grav['assets']->addJs('plugin://git-sync/js/app.js', ['loading' => 'defer']);
158158
}
159+
160+
return true;
159161
}
160162

161163
public function onPageInitialized()

images/repos/gitlogo.svg

Lines changed: 65 additions & 0 deletions
Loading

js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scss/plugin/_wizard.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@
77
color: #366188;
88
}
99
}
10+
11+
.access-tokens {
12+
h3 {
13+
margin-top: 1rem;
14+
}
15+
16+
a {
17+
vertical-align: inherit !important;
18+
}
19+
}
20+
21+
.access-tokens-details {
22+
> p {
23+
margin-top: 0;
24+
}
25+
26+
> div > ul {
27+
margin-bottom: 0;
28+
}
29+
}
1030

1131
.center {
1232
text-align: center;
@@ -52,6 +72,23 @@
5272
flex: 1;
5373
}
5474
}
75+
76+
.step-1 {
77+
div.column:nth-child(1) {
78+
flex-grow: 1.5;
79+
80+
> label:nth-child(4) {
81+
width: 110%;
82+
}
83+
}
84+
85+
div.column:nth-child(2) {
86+
margin-left: 25px;
87+
}
88+
div.column:nth-child(2) > label:nth-child(1) > input:nth-child(1), div.column:nth-child(2) > label:nth-child(2) > input:nth-child(1) {
89+
width: 85%;
90+
}
91+
}
5592
}
5693

5794
#admin-main [data-grav-field="git-wizard"] {

templates/forms/fields/enc-password/enc-password.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
{% block input_attributes %}
88
type="password"
99
class="input"
10-
placeholder="{{ passwordStored ? (isEncrypted ? 'Your password is stored and won\'t show up here for security reasons. Type again to change and save' : 'Your password is stored but not encrypted. Type it in again and save.') : field.placeholder }}"
10+
placeholder="{{ passwordStored ? (isEncrypted ? 'Your password is securely stored.' : 'Your password is stored but not encrypted.') : field.placeholder }}"
1111
{{ parent() }}
1212
{% endblock %}

0 commit comments

Comments
 (0)