Commit b4fccf8a authored by Jacob Schatz's avatar Jacob Schatz

Fixes staging files to show only when commitable

parent 40fd91b8
...@@ -13,12 +13,22 @@ const RepoCommitSection = { ...@@ -13,12 +13,22 @@ const RepoCommitSection = {
// actions[] // actions[]
// author_email // author_email
// author_name // author_name
const branchName = $("button.dropdown-menu-toggle").attr('data-ref'); const branch = $("button.dropdown-menu-toggle").attr('data-ref');
const commitMessage = this.commitMessage; const commitMessage = this.commitMessage;
const actions = this.changedFiles.map(f => { const actions = this.changedFiles.map(f => {
return f.url.split(branchName)[1]; const filePath = f.url.split(branch)[1];
return {
action: 'update',
file_path: filePath,
content: f.newContent,
};
}); });
console.log(branchName, commitMessage, actions); const payload = {
branch: branch,
commit_message: commitMessage,
actions: actions,
}
console.log(branch, commitMessage, actions);
} }
}, },
...@@ -94,7 +104,7 @@ export default RepoCommitSection; ...@@ -94,7 +104,7 @@ export default RepoCommitSection;
</div> </div>
</div> </div>
<div class="col-md-offset-4 col-md-4"> <div class="col-md-offset-4 col-md-4">
<button type="submit" class="btn btn-success" @click.prevent="makeCommit">Commit {{changedFiles.length}} Files</button> <button type="submit" :disabled="!commitMessage" class="btn btn-success" @click.prevent="makeCommit">Commit {{changedFiles.length}} Files</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>
......
#repo{ data: { url: repo_url(@project), 'project-name' => @project.name, refs_url: refs_namespace_project_path(@project.namespace, @project, format: "json") } } #repo{ data: { url: repo_url(@project), 'project-name' => @project.name, refs_url: refs_namespace_project_path(@project.namespace, @project, format: "json"), project_url: namespace_project_path(@project.namespace, @project) } }
- if can_edit_tree? - if can_edit_tree?
= render 'projects/blob/upload', title: _('Upload New File'), placeholder: _('Upload New File'), button_title: _('Upload file'), form_path: project_create_blob_path(@project, @id), method: :post = render 'projects/blob/upload', title: _('Upload New File'), placeholder: _('Upload New File'), button_title: _('Upload file'), form_path: project_create_blob_path(@project, @id), method: :post
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment