Added projects. Part 4
36
app.rb
@@ -346,6 +346,42 @@ post "/prjcreate" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/prjedit/:id" do
|
||||||
|
prj = ProjectsActions.new(cfg.get_projects_path, db)
|
||||||
|
if prj.path.nil?
|
||||||
|
print_error_page(503, "Путь к проектам не существует")
|
||||||
|
else
|
||||||
|
repo = GitRepo.new(cfg.get_repo, db)
|
||||||
|
if repo.path.nil?
|
||||||
|
print_error_page(503, "Путь к репозиториям не существует")
|
||||||
|
else
|
||||||
|
prj_info = prj.get_project(params["id"])
|
||||||
|
if prj_info.nil?
|
||||||
|
print_error_page(503, "Путь к проектам не существует")
|
||||||
|
else
|
||||||
|
@page_name = prj_info[:projname]
|
||||||
|
@proj_name = prj_info[:projname]
|
||||||
|
@proj_descr = prj_info[:descr]
|
||||||
|
@proj_id = prj_info[:id]
|
||||||
|
repo_lst = repo.getrepos
|
||||||
|
proj_repo_list = prj.get_project_gits(prj_info[:id])
|
||||||
|
@repo_list = repo_lst.reject do |item|
|
||||||
|
fnd = false
|
||||||
|
proj_repo_list.each do |item2|
|
||||||
|
if item2[:id] == item[:id]
|
||||||
|
fnd = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fnd
|
||||||
|
end
|
||||||
|
@proj_repo = proj_repo_list
|
||||||
|
erb :prjinfo
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
not_found do
|
not_found do
|
||||||
status 404
|
status 404
|
||||||
@page_name = "Кто-то потерялся"
|
@page_name = "Кто-то потерялся"
|
||||||
|
|||||||
@@ -119,6 +119,10 @@ class DBase
|
|||||||
Projects.order(:id).all
|
Projects.order(:id).all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def proj(id)
|
||||||
|
Projects[id]
|
||||||
|
end
|
||||||
|
|
||||||
def proj_create(proj_name, proj_descr)
|
def proj_create(proj_name, proj_descr)
|
||||||
@error = nil
|
@error = nil
|
||||||
data = Projects.where(projname: proj_name).first
|
data = Projects.where(projname: proj_name).first
|
||||||
@@ -130,4 +134,17 @@ class DBase
|
|||||||
end
|
end
|
||||||
@error
|
@error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_gits_for_projects(id)
|
||||||
|
result = []
|
||||||
|
git_list = ReposProjects.where(proj_id: id.to_i).all
|
||||||
|
unless git_list.nil?
|
||||||
|
result = git_list.map do |item|
|
||||||
|
Repos[item[:repo_id]]
|
||||||
|
end.reject do |item|
|
||||||
|
item.nil?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ class ProjectsActions
|
|||||||
prj
|
prj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_project(id)
|
||||||
|
prj = nil
|
||||||
|
File.open("locks/prjcreate", "r") do |f|
|
||||||
|
f.flock(File::LOCK_SH)
|
||||||
|
prj = @db.proj(id.to_i)
|
||||||
|
end
|
||||||
|
prj
|
||||||
|
end
|
||||||
|
|
||||||
def create_project(name, description, configuration)
|
def create_project(name, description, configuration)
|
||||||
@error = nil
|
@error = nil
|
||||||
ret_val = 0
|
ret_val = 0
|
||||||
@@ -77,4 +86,8 @@ class ProjectsActions
|
|||||||
end
|
end
|
||||||
ret_val
|
ret_val
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_project_gits(id)
|
||||||
|
@db.get_gits_for_projects(id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
8
public/assets/bootstrap/css/bootstrap.min.css
vendored
Executable file → Normal file
7
public/assets/bootstrap/js/bootstrap.min.js
vendored
Executable file → Normal file
0
public/assets/css/Footer-Dark-icons.css
Executable file → Normal file
0
public/assets/css/styles.min.css
vendored
Executable file → Normal file
5
public/assets/font/bootstrap-icons.min.css
vendored
Normal file
BIN
public/assets/font/fonts/bootstrap-icons.woff
Normal file
BIN
public/assets/font/fonts/bootstrap-icons.woff2
Normal file
0
public/js/edit_area_full.js
Executable file → Normal file
0
public/js/images/autocompletion.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
0
public/js/images/close.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 102 B After Width: | Height: | Size: 102 B |
0
public/js/images/fullscreen.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
0
public/js/images/go_to_line.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
0
public/js/images/help.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
0
public/js/images/highlight.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
0
public/js/images/load.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
0
public/js/images/move.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
0
public/js/images/newdocument.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
0
public/js/images/opacity.png
Executable file → Normal file
|
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
0
public/js/images/processing.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 825 B |
0
public/js/images/redo.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 169 B |
0
public/js/images/reset_highlight.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
0
public/js/images/save.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 285 B |
0
public/js/images/search.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
0
public/js/images/smooth_selection.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 174 B |
0
public/js/images/spacer.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
0
public/js/images/statusbar_resize.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 79 B After Width: | Height: | Size: 79 B |
0
public/js/images/undo.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
0
public/js/images/word_wrap.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 951 B After Width: | Height: | Size: 951 B |
0
public/js/jquery.dropdown.min.css
vendored
Executable file → Normal file
0
public/js/jquery.dropdown.min.js
vendored
Executable file → Normal file
0
public/js/langs/ru.js
Executable file → Normal file
0
public/js/plugins/charmap/charmap.js
Executable file → Normal file
0
public/js/plugins/charmap/css/charmap.css
Executable file → Normal file
0
public/js/plugins/charmap/images/charmap.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
0
public/js/plugins/charmap/jscripts/map.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/bg.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/cs.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/de.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/dk.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/en.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/eo.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/es.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/fr.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/hr.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/it.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/ja.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/mk.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/nl.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/pl.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/pt.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/ru.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/sk.js
Executable file → Normal file
0
public/js/plugins/charmap/langs/zh.js
Executable file → Normal file
0
public/js/plugins/charmap/popup.html
Executable file → Normal file
0
public/js/plugins/test/css/test.css
Executable file → Normal file
0
public/js/plugins/test/images/Thumbs.db
Executable file → Normal file
0
public/js/plugins/test/images/test.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 87 B After Width: | Height: | Size: 87 B |