Skip to content

Commit

Permalink
Merge pull request #209 from wearepal/select-project-extent
Browse files Browse the repository at this point in the history
Update extent from the project
  • Loading branch information
paulthatjazz authored Nov 23, 2023
2 parents bb5c211 + 99e9924 commit 7d3b2eb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def update
existing_source["name"] = params.require(:project).require(:name)
existing_source["extent"] = params.require(:project).require(:extent).split(",").map(&:to_f)
if @project.update(source: existing_source)
redirect_to team_projects_url(@team)
if params[:commit] == 'Save and open project'
redirect_to project_url(@project)
elsif params[:commit] == 'Save and return to menus'
redirect_to team_projects_url(@team)
end
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion app/javascript/projects/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ export const Toolbar = ({ backButtonPath, projectName, hasUnsavedChanges, curren
</button>
</div>
<div className="btn-group mr-2">
<button className={`btn btn-sm btn-outline-primary`} onMouseEnter={() => setShowExtent(true)} onMouseLeave={() => setShowExtent(false)} onClick={() => console.log("WIP")}>
<a href={`${window.location}/edit`}>
<button className={`btn btn-sm btn-outline-primary`} onMouseEnter={() => setShowExtent(true)} onMouseLeave={() => setShowExtent(false)}>
<i className="fas fa-square" /> Extent
</button>
</a>
<div title={`Zoom level = ${zoomLevel}`} className="p-1 " style={{backgroundColor: zoomLevel > 20 ? "green" : (zoomLevel < 20 ? "orange" : "yellow"), fontSize: ".9em"}}>
{zoomLevel > 20 ? "High" : (zoomLevel < 20 ? "Low" : "Med")}
</div>
Expand Down
3 changes: 1 addition & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@
const tiles = tileGrid.getTileRangeForExtentAndZ(extent, zoom)
const tileCount = tiles.getWidth() * tiles.getHeight()
if(tileCount <= maxtiles){
console.log('zoom', zoom, 'tiles', tileCount)
return zoom
}
}

}

function showZoom(){
Expand Down
6 changes: 5 additions & 1 deletion app/views/projects/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
</div>
<div id="map" style="width: 100%; height: 400px; margin-bottom: 10px;"></div>
<div id="guide" style="margin-bottom: 10px"></div>
<%= f.submit 'Update Project', class: 'btn btn-primary' %>


<%= link_to 'Cancel', :back, class: 'btn btn-secondary' %>
<%= f.submit 'Save and open project', class: 'btn btn-primary' %>
<%= f.submit 'Save and return to menus', class: 'btn btn-primary' %>
<% end %>
</div>

Expand Down

0 comments on commit 7d3b2eb

Please sign in to comment.