Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update extent from the project #209

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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