added the edit link to the code blame view
This commit is contained in:
		| @ -221,7 +221,7 @@ class Code extends Controller | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	function edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) | ||||
| 	protected function _edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD, $caller = 'file') | ||||
| 	{ | ||||
| 		$this->load->model ('ProjectModel', 'projects'); | ||||
| 		$this->load->model ('SubversionModel', 'subversion'); | ||||
| @ -291,6 +291,7 @@ class Code extends Controller | ||||
| 					$data['headpath'] = $path; | ||||
| 					$data['file'] = $file;  | ||||
| 					$data['revision'] = $rev; | ||||
| 					$data['caller'] = $caller; | ||||
|  | ||||
| 					$this->load->view ($this->VIEW_EDIT, $data); | ||||
| 				} | ||||
| @ -305,6 +306,16 @@ class Code extends Controller | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	function edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) | ||||
| 	{ | ||||
| 		return $this->_edit ($projectid, $path, $rev, 'file'); | ||||
| 	} | ||||
|  | ||||
| 	function bledit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) | ||||
| 	{ | ||||
| 		return $this->_edit ($projectid, $path, $rev, 'blame'); | ||||
| 	} | ||||
|  | ||||
| 	function enjson_save ($projectid = '', $path = '') | ||||
| 	{ | ||||
| 		$this->load->model ('ProjectModel', 'projects'); | ||||
|  | ||||
| @ -51,6 +51,7 @@ $(function () { | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	$("#code_blame_mainarea_edit_button").button(); | ||||
| 	prettyPrint (); | ||||
| }); | ||||
| </script> | ||||
| @ -153,7 +154,8 @@ $xpar = $this->converter->AsciiToHex ($headpath); | ||||
|  | ||||
| if ($file['created_rev'] != $file['head_rev']) | ||||
| { | ||||
| 	print anchor ("code/blame/{$project->id}/${xpar}", $this->lang->line('Head revision')); | ||||
| 	$head_revision_text = '<i class="fa fa-exclamation-triangle" style="color:#CC2222"></i> ' . $this->lang->line('Head revision'); | ||||
| 	print anchor ("code/blame/{$project->id}/${xpar}", $head_revision_text); | ||||
| 	print ' | '; | ||||
| } | ||||
|  | ||||
| @ -190,18 +192,24 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_tex | ||||
| 			sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev']) | ||||
| 		); | ||||
|  | ||||
|                 if (!empty($file['created_tag'])) | ||||
|                 { | ||||
| 		if (!empty($file['created_tag'])) | ||||
| 		{ | ||||
| 			print ' '; | ||||
| 			print ('<span class="left_arrow_indicator">'); | ||||
| 			print htmlspecialchars($file['created_tag']); | ||||
| 			print ('</span>'); | ||||
|                 } | ||||
| 		} | ||||
| 		print ' '; | ||||
| 		print anchor ("code/blame/{$project->id}/${xpar}/{$file['next_rev']}", '<i class="fa fa-arrow-circle-right"></i>'); | ||||
|  | ||||
| 		print ' | '; | ||||
| 		printf ('%s: %s', $this->lang->line('Size'), $file['size']); | ||||
|  | ||||
| 		if ((isset($login['id']) && $login['id'] != '')) | ||||
| 		{ | ||||
| 			print ' '; | ||||
| 			print anchor ("code/bledit/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Edit'), 'id="code_blame_mainarea_edit_button"'); | ||||
| 		} | ||||
| 	?> | ||||
| 	<a id="code_blame_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a> | ||||
| </div> | ||||
|  | ||||
| @ -33,7 +33,7 @@ $hex_headpath = $this->converter->AsciiToHex($headpath); | ||||
| ?> | ||||
|  | ||||
| <script type="text/javascript"> | ||||
| var base_return_anchor = codepot_merge_path('<?php print site_url() ?>', '<?php print "/code/file/{$project->id}/{$hex_headpath}" ?>'); | ||||
| var base_return_anchor = codepot_merge_path('<?php print site_url() ?>', '<?php print "/code/${caller}/{$project->id}/{$hex_headpath}" ?>'); | ||||
|  | ||||
| function resize_editor() | ||||
| { | ||||
| @ -253,7 +253,7 @@ $this->load->view ( | ||||
| <div class="title" id="code_edit_mainarea_title"> | ||||
| <?php | ||||
| 	print anchor ( | ||||
| 		"code/file/{$project->id}{$revreqroot}", | ||||
| 		"code/${caller}/{$project->id}{$revreqroot}", | ||||
| 		htmlspecialchars($project->name)); | ||||
|  | ||||
| 	$exps = explode ('/', $headpath); | ||||
| @ -266,7 +266,7 @@ $this->load->view ( | ||||
|  | ||||
| 		print '/'; | ||||
| 		print anchor ( | ||||
| 			"code/file/{$project->id}/{$xpar}{$revreq}", | ||||
| 			"code/${caller}/{$project->id}/{$xpar}{$revreq}", | ||||
| 			htmlspecialchars($exps[$i])); | ||||
| 	} | ||||
|  | ||||
| @ -284,9 +284,9 @@ $this->load->view ( | ||||
| 		/* Saving file work on the head only. so the links here don't include the given revision anymore */ | ||||
| 		print '<select id="code_edit_mainarea_mode"></select>'; | ||||
| 		print ' '; | ||||
| 		print anchor ("code/file/{$project->id}/{$hex_headpath}", $this->lang->line('Save'), 'id="code_edit_mainarea_save_button"'); | ||||
| 		print anchor ("code/${caller}/{$project->id}/{$hex_headpath}", $this->lang->line('Save'), 'id="code_edit_mainarea_save_button"'); | ||||
| 		print ' '; | ||||
| 		print anchor ("code/file/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Return'), 'id="code_edit_mainarea_return_button"'); | ||||
| 		print anchor ("code/${caller}/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Return'), 'id="code_edit_mainarea_return_button"'); | ||||
| 	?> | ||||
|  | ||||
| </div> | ||||
|  | ||||
| @ -173,9 +173,10 @@ $this->load->view ( | ||||
|  | ||||
| 	if ($file['created_rev'] != $file['head_rev'])  | ||||
| 	{ | ||||
| 		$head_revision_text = '<i class="fa fa-exclamation-triangle" style="color:#CC2222"></i> ' . $this->lang->line('Head revision'); | ||||
| 		print anchor ( | ||||
| 			"code/file/{$project->id}/${xpar}", | ||||
| 			$this->lang->line('Head revision')); | ||||
| 			$head_revision_text); | ||||
| 		print ' | '; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| @ -487,7 +487,8 @@ $this->load->view ( | ||||
| 		$xpar = $this->converter->AsciiTohex ($headpath); | ||||
| 		if ($revision > 0 && $revision < $next_revision) | ||||
| 		{ | ||||
| 			print anchor ("code/file/{$project->id}/{$xpar}", $this->lang->line('Head revision')); | ||||
| 			$head_revision_text = '<i class="fa fa-exclamation-triangle" style="color:#CC2222"></i> ' . $this->lang->line('Head revision'); | ||||
| 			print anchor ("code/file/{$project->id}/{$xpar}", $head_revision_text); | ||||
| 			print ' | '; | ||||
| 		} | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user